@@ -16,20 +16,20 @@ npm install --save-dev http-proxy-middleware
16
16
Create and configure the proxy middleware.
17
17
``` javascript
18
18
var proxy = proxyMiddleware (' /api' , {target: ' http://www.example.org' });
19
- // 'proxy' is now ready to be used is a server.
19
+ // 'proxy' is now ready to be used in a server.
20
20
21
21
```
22
22
23
23
## Example
24
24
``` javascript
25
- // dependencies
25
+ // include dependencies
26
26
var express = require (' express' );
27
27
var proxyMiddleware = require (' http-proxy-middleware' );
28
28
29
29
// configure proxy middleware
30
30
var context = ' /api' ; // requests with this path will be proxied
31
31
var options = {
32
- target: ' http://www.example.org' , // target
32
+ target: ' http://www.example.org' , // target host
33
33
changeOrigin: true // needed for virtual hosted sites
34
34
};
35
35
@@ -75,8 +75,7 @@ The following options are provided by the underlying [http-proxy](https://www.np
75
75
* **option.toProxy**: passes the absolute URL as the `path` (useful for proxying to proxies)
76
76
* **option.hostRewrite**: rewrites the location hostname on (301/302/307/308) redirects.
77
77
78
- Undocumented options are provided by the underlying [http-proxy](https://www.npmjs.com/package/http-proxy).
79
- https://github.com/nodejitsu/node-http-proxy/blob/master/lib/http-proxy.js#L32
78
+ Undocumented options are provided by the underlying [http-proxy](https://github.com/nodejitsu/node-http-proxy/blob/master/lib/http-proxy.js#L32).
80
79
* **option.headers**: object, adds [request headers](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields). (Example: `{host:' www .example .org ' }`
81
80
* **option.changeOrigin**: true/false, adds host to request header.
82
81
* **option.prependPath**: true/false, Default: true - specify whether you want to prepend the target' s path to the proxy path>
0 commit comments