Skip to content

Commit 930c208

Browse files
author
fzheng
committed
editing readme http-party#2
1 parent a980740 commit 930c208

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

README.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -234,26 +234,6 @@ httpProxy.createServer({
234234
}).listen(8014);
235235
```
236236

237-
#### Tracking the redirection
238-
```js
239-
//
240-
// Create a proxy server, and not allow redirection breaking the proxy
241-
//
242-
httpProxy.createProxyServer({
243-
agent : http.globalAgent,
244-
target: {
245-
protocol: 'http:',
246-
host: 'www1.macys.com'
247-
},
248-
headers: {
249-
host: 'www1.macys.com'
250-
},
251-
trapRedirect: {
252-
target: "localhost:8011"
253-
}
254-
}).listen(8011);
255-
```
256-
257237
Also you can proxy the websocket requests just calling the `ws(req, socket, head)` method.
258238

259239
```js
@@ -281,6 +261,26 @@ proxyServer.on('upgrade', function (req, socket, head) {
281261
proxyServer.listen(8015);
282262
```
283263

264+
#### Tracking the redirection
265+
```js
266+
//
267+
// Create a proxy server, and not allow redirection breaking the proxy
268+
//
269+
httpProxy.createProxyServer({
270+
agent : http.globalAgent,
271+
target: {
272+
protocol: 'http:',
273+
host: 'www1.macys.com'
274+
},
275+
headers: {
276+
host: 'www1.macys.com'
277+
},
278+
trapRedirect: {
279+
target: "localhost:8011"
280+
}
281+
}).listen(8011);
282+
```
283+
284284
### Contributing and Issues
285285

286286
* Search on Google/Github
@@ -309,7 +309,7 @@ If you would like to track redirection and not allow it breaking your reverse pr
309309

310310
* **trapRedirect**: object to be passed to http(s).request
311311
* **trapRedirect.source** (optional): the source domain/url of the redirection starts, by default, **target.domain** or **headers.domain** will be used
312-
* **trapRedirect.target**: the target domain/url you wish the redirection go instead
312+
* **trapRedirect.target**: the target domain/url you wish the redirection to go instead
313313

314314
### Test
315315

0 commit comments

Comments
 (0)