-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
19 changed files
with
281 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ Proxy middleware for Deno Oak HTTP servers. | |
</p> | ||
|
||
```ts | ||
import { proxy } from "https://deno.land/x/oak_http_proxy@2.2.0/mod.ts"; | ||
import { proxy } from "https://deno.land/x/oak_http_proxy@2.3.0/mod.ts"; | ||
import { Application } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
const app = new Application(); | ||
|
@@ -32,13 +32,13 @@ Before importing, [download and install Deno](https://deno.land/#installation). | |
You can then import oak-http-proxy straight into your project: | ||
|
||
```ts | ||
import { proxy } from "https://deno.land/x/oak_http_proxy@2.2.0/mod.ts"; | ||
import { proxy } from "https://deno.land/x/oak_http_proxy@2.3.0/mod.ts"; | ||
``` | ||
|
||
oak-http-proxy is also available on [nest.land](https://nest.land/package/oak-http-proxy), a package registry for Deno on the Blockchain. | ||
|
||
```ts | ||
import { proxy } from "https://x.nest.land/oak-http-proxy@2.2.0/mod.ts"; | ||
import { proxy } from "https://x.nest.land/oak-http-proxy@2.3.0/mod.ts"; | ||
``` | ||
|
||
## Docs | ||
|
@@ -67,6 +67,15 @@ router.get( | |
|
||
Note: Unmatched path segments of the incoming request url _are not_ transferred to the outbound proxy URL. For dynamic proxy urls use the function form. | ||
|
||
### Streaming | ||
|
||
Proxy requests and user responses are piped/streamed/chunked by default. | ||
|
||
If you define a response modifier (`srcResDecorator`, `srcResHeaderDecorator`), | ||
or need to inspect the response before continuing (`filterRes`), streaming is | ||
disabled, and the request and response are buffered. This can cause performance | ||
issues with large payloads. | ||
|
||
### Proxy Options | ||
|
||
You can also provide several options which allow you to filter, customize and decorate proxied requests and responses. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
export { STATUS_TEXT } from "https://deno.land/[email protected]/http/status.ts"; | ||
export { createState } from "https://deno.land/x/opineHttpProxy@3.1.0/src/createState.ts"; | ||
export { createState } from "https://deno.land/x/opineHttpProxy@3.2.0/src/createState.ts"; | ||
export type { | ||
ProxyState, | ||
ProxyUrlFunction, | ||
} from "https://deno.land/x/opineHttpProxy@3.1.0/src/createState.ts"; | ||
export type { ProxyOptions } from "https://deno.land/x/opineHttpProxy@3.1.0/src/resolveOptions.ts"; | ||
export { isUnset } from "https://deno.land/x/opineHttpProxy@3.1.0/src/isUnset.ts"; | ||
export { decorateProxyReqUrl } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/decorateProxyReqUrl.ts"; | ||
export { decorateProxyReqInit } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/decorateProxyReqInit.ts"; | ||
export { prepareProxyReq } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/prepareProxyReq.ts"; | ||
export { sendProxyReq } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/sendProxyReq.ts"; | ||
export { filterProxyRes } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/filterProxyRes.ts"; | ||
export { decorateSrcResHeaders } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/decorateSrcResHeaders.ts"; | ||
export { decorateSrcRes } from "https://deno.land/x/opineHttpProxy@3.1.0/src/steps/decorateSrcRes.ts"; | ||
} from "https://deno.land/x/opineHttpProxy@3.2.0/src/createState.ts"; | ||
export type { ProxyOptions } from "https://deno.land/x/opineHttpProxy@3.2.0/src/resolveOptions.ts"; | ||
export { isUnset } from "https://deno.land/x/opineHttpProxy@3.2.0/src/isUnset.ts"; | ||
export { decorateProxyReqUrl } from "https://deno.land/x/opineHttpProxy@3.2.0/src/steps/decorateProxyReqUrl.ts"; | ||
export { decorateProxyReqInit } from "https://deno.land/x/opineHttpProxy@3.2.0/src/steps/decorateProxyReqInit.ts"; | ||
export { prepareProxyReq } from "https://deno.land/x/opineHttpProxy@3.2.0/src/steps/prepareProxyReq.ts"; | ||
export { sendProxyReq } from "https://deno.land/x/opineHttpProxy@3.2.0/src/steps/sendProxyReq.ts"; | ||
export { filterProxyRes } from "https://deno.land/x/opineHttpProxy@3.2.0/src/steps/filterProxyRes.ts"; | ||
export { decorateSrcResHeaders } from "https://deno.land/x/opineHttpProxy@3.2.0/src/steps/decorateSrcResHeaders.ts"; | ||
export { decorateSrcRes } from "https://deno.land/x/opineHttpProxy@3.2.0/src/steps/decorateSrcRes.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,7 +74,7 @@ <h1>oak-http-proxy</h1> | |
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/oak_http_proxy/mod.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fupdates%2Fx%2Foak_http_proxy%2Fmod.ts" alt="oak-http-proxy dependency outdatedness" /></a> | ||
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/oak_http_proxy/mod.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fcache-size%2Fx%2Foak_http_proxy%2Fmod.ts" alt="oak-http-proxy cached size" /></a> | ||
</p> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/oak_http_proxy@2.2.0/mod.ts"</span>; | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/oak_http_proxy@2.3.0/mod.ts"</span>; | ||
<span class="hljs-keyword">import</span> { Application } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/[email protected]/mod.ts"</span>; | ||
|
||
<span class="hljs-keyword">const</span> app = <span class="hljs-keyword">new</span> Application(); | ||
|
@@ -89,10 +89,10 @@ <h2>Installation</h2> | |
<p>This is a <a href="https://deno.land/">Deno</a> module available to import direct from this repo and via the <a href="https://deno.land/x">Deno Registry</a>.</p> | ||
<p>Before importing, <a href="https://deno.land/#installation">download and install Deno</a>.</p> | ||
<p>You can then import oak-http-proxy straight into your project:</p> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/oak_http_proxy@2.2.0/mod.ts"</span>; | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/oak_http_proxy@2.3.0/mod.ts"</span>; | ||
</code></pre> | ||
<p>oak-http-proxy is also available on <a href="https://nest.land/package/oak-http-proxy">nest.land</a>, a package registry for Deno on the Blockchain.</p> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://x.nest.land/oak-http-proxy@2.2.0/mod.ts"</span>; | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { proxy } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://x.nest.land/oak-http-proxy@2.3.0/mod.ts"</span>; | ||
</code></pre> | ||
<a href="#docs" id="docs" style="color: inherit; text-decoration: none;"> | ||
<h2>Docs</h2> | ||
|
@@ -120,6 +120,14 @@ <h3>URL</h3> | |
); | ||
</code></pre> | ||
<p>Note: Unmatched path segments of the incoming request url <em>are not</em> transferred to the outbound proxy URL. For dynamic proxy urls use the function form.</p> | ||
<a href="#streaming" id="streaming" style="color: inherit; text-decoration: none;"> | ||
<h3>Streaming</h3> | ||
</a> | ||
<p>Proxy requests and user responses are piped/streamed/chunked by default.</p> | ||
<p>If you define a response modifier (<code>srcResDecorator</code>, <code>srcResHeaderDecorator</code>), | ||
or need to inspect the response before continuing (<code>filterRes</code>), streaming is | ||
disabled, and the request and response are buffered. This can cause performance | ||
issues with large payloads.</p> | ||
<a href="#proxy-options" id="proxy-options" style="color: inherit; text-decoration: none;"> | ||
<h3>Proxy Options</h3> | ||
</a> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.