Skip to content

Commit 6106d4c

Browse files
committed
Added back to top helpers
1 parent cd1d777 commit 6106d4c

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ proxies and load balancers.
1818

1919
### Table of Contents
2020
* [Installation](#installation)
21-
* [Upgrading from 0.8.x ?](#upgrade-from-08x)
21+
* [Upgrading from 0.8.x ?](#upgrading-from-08x-)
2222
* [Core Concept](#core-concept)
2323
* [Use Cases](#use-cases)
2424
* [Setup a basic stand-alone proxy server](#setup-a-basic-stand-alone-proxy-server)
@@ -42,10 +42,14 @@ proxies and load balancers.
4242

4343
`npm install http-proxy --save`
4444

45+
**[Back to top](#table-of-contents)**
46+
4547
### Upgrading from 0.8.x ?
4648

4749
Click [here](UPGRADING.md)
4850

51+
**[Back to top](#table-of-contents)**
52+
4953
### Core Concept
5054

5155
A new proxy is created by calling `createProxyServer` and passing
@@ -93,6 +97,8 @@ The first pipeline (ingoing) is responsible for the creation and manipulation of
9397
The second pipeline (outgoing) is responsible for the creation and manipulation of the stream that, from your target, returns data
9498
to the client.
9599

100+
**[Back to top](#table-of-contents)**
101+
96102
### Use Cases
97103

98104
#### Setup a basic stand-alone proxy server
@@ -116,6 +122,8 @@ http.createServer(function (req, res) {
116122
```
117123
†Invoking listen(..) triggers the creation of a web server. Otherwise, just the proxy instance is created.
118124

125+
**[Back to top](#table-of-contents)**
126+
119127
#### Setup a stand-alone proxy server with custom server logic
120128
This example show how you can proxy a request using your own HTTP server
121129
and also you can put your own logic to handle the request.
@@ -144,6 +152,8 @@ console.log("listening on port 5050")
144152
server.listen(5050);
145153
```
146154

155+
**[Back to top](#table-of-contents)**
156+
147157
#### Setup a stand-alone proxy server with proxy request header re-writing
148158
This example shows how you can proxy a request using your own HTTP server that
149159
modifies the outgoing proxy request by adding a special header.
@@ -181,11 +191,15 @@ console.log("listening on port 5050")
181191
server.listen(5050);
182192
```
183193

194+
**[Back to top](#table-of-contents)**
195+
184196
#### Modify a response from a proxied server
185197
Sometimes when you have received a HTML/XML document from the server of origin you would like to modify it before forwarding it on.
186198

187199
[Harmon](https://github.com/No9/harmon) allows you to do this in a streaming style so as to keep the pressure on the proxy to a minimum.
188200

201+
**[Back to top](#table-of-contents)**
202+
189203
#### Setup a stand-alone proxy server with latency
190204

191205
```js
@@ -220,6 +234,8 @@ http.createServer(function (req, res) {
220234
}).listen(9008);
221235
```
222236

237+
**[Back to top](#table-of-contents)**
238+
223239
#### Using HTTPS
224240
You can activate the validation of a secure SSL certificate to the target connection (avoid self signed certs), just set `secure: true` in the options.
225241

@@ -257,6 +273,8 @@ httpProxy.createServer({
257273
}).listen(443);
258274
```
259275

276+
**[Back to top](#table-of-contents)**
277+
260278
#### Proxying WebSockets
261279
You can activate the websocket support for the proxy using `ws:true` in the options.
262280

@@ -297,6 +315,8 @@ proxyServer.on('upgrade', function (req, socket, head) {
297315
proxyServer.listen(8015);
298316
```
299317

318+
**[Back to top](#table-of-contents)**
319+
300320
### Options
301321

302322
`httpProxy.createProxyServer` supports the following options:
@@ -327,6 +347,8 @@ If you are using the `proxyServer.listen` method, the following options are also
327347
* **ssl**: object to be passed to https.createServer()
328348
* **ws**: true/false, if you want to proxy websockets
329349

350+
**[Back to top](#table-of-contents)**
351+
330352
### Listening for proxy events
331353

332354
* `error`: The error event is emitted if the request to the target fail. **We do not do any error handling of messages passed between client and proxy, and messages passed between proxy and target, so it is recommended that you listen on errors and handle them.**
@@ -383,6 +405,8 @@ proxy.on('close', function (req, socket, head) {
383405
});
384406
```
385407

408+
**[Back to top](#table-of-contents)**
409+
386410
### Shutdown
387411

388412
* When testing or running server within another program it may be necessary to close the proxy.
@@ -399,6 +423,8 @@ var proxy = new httpProxy.createProxyServer({
399423
proxy.close();
400424
```
401425

426+
**[Back to top](#table-of-contents)**
427+
402428
### Miscellaneous
403429

404430
#### ProxyTable API
@@ -415,6 +441,8 @@ $ npm test
415441

416442
Logo created by [Diego Pasquali](http://dribbble.com/diegopq)
417443

444+
**[Back to top](#table-of-contents)**
445+
418446
### Contributing and Issues
419447

420448
* Search on Google/Github
@@ -423,6 +451,8 @@ Logo created by [Diego Pasquali](http://dribbble.com/diegopq)
423451
* Commit to your local branch (which must be different from `master`)
424452
* Submit your Pull Request (be sure to include tests and update documentation)
425453

454+
**[Back to top](#table-of-contents)**
455+
426456
### License
427457

428458
>The MIT License (MIT)

0 commit comments

Comments
 (0)