You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The forwarding option can be used in conjunction with the proxy table options by simply including both the 'forward' and 'router' properties in the options passed to 'createServer'.
218
218
219
-
### Using node-http-proxy from the command line
220
-
When you install this package with npm, a node-http-proxy binary will become available to you. Using this binary is easy with some simple options:
221
219
220
+
## Using HTTPS
221
+
You have all the full flexibility of node-http-proxy offers in HTTPS as well as HTTP. The two basic scenarios are: with a stand-alone proxy server or in conjunction with another HTTPS server.
222
+
223
+
### Proxying to HTTP from HTTPS
224
+
This is probably the most common use-case for proxying in conjunction with HTTPS. You have some front-facing HTTPS server, but all of your internal traffic is HTTP. In this way, you can reduce the number of servers to which your CA and other important security files are deployed and reduce the computational overhead from HTTPS traffic.
225
+
226
+
Using HTTPS in `node-http-proxy` is relatively straight-forward:
You have all the full flexibility of node-http-proxy offers in HTTPS as well as HTTP. The two basic scenarios are: with a stand-alone proxy server or in conjunction with another HTTPS server.
266
+
### Proxying to HTTPS from HTTPS
267
+
Proxying from HTTPS to HTTPS is essentially the same as proxying from HTTPS to HTTP, but you must include `target` option in when calling `httpProxy.createServer` or instantiating a new instance of `HttpProxy`.
// Create an instance of HttpProxy to use with another HTTPS server
257
291
//
258
-
var proxy = new httpProxy.HttpProxy({ https: true });
292
+
var proxy =newhttpProxy.HttpProxy({
293
+
target: {
294
+
https:true
295
+
}
296
+
});
297
+
259
298
https.createServer(options.https, function (req, res) {
260
299
proxy.proxyRequest(req, res, {
261
300
host:'localhost',
@@ -273,7 +312,7 @@ https.createServer(options.https, function (req, res) {
273
312
}).listen(8000);
274
313
```
275
314
276
-
### Proxying WebSockets
315
+
## Proxying WebSockets
277
316
Websockets are handled automatically when using the `httpProxy.createServer()`, but if you want to use it in conjunction with a stand-alone HTTP + WebSocket (such as [socket.io][5]) server here's how:
When you install this package with npm, a node-http-proxy binary will become available to you. Using this binary is easy with some simple options:
350
+
351
+
```js
352
+
usage: node-http-proxy [options]
353
+
354
+
All options should be set with the syntax --option=value
355
+
356
+
options:
357
+
--port PORT Port that the proxy server should run on
358
+
--target HOST:PORTLocationof the server the proxy will target
359
+
--config OUTFILELocationof the configuration file for the proxy server
360
+
--silent Silence the log output from the proxy server
361
+
-h, --help You're staring at it
362
+
```
363
+
309
364
<br/>
310
-
### Why doesn't node-http-proxy have more advanced features like x, y, or z?
365
+
## Why doesn't node-http-proxy have more advanced features like x, y, or z?
311
366
312
367
If you have a suggestion for a feature currently not supported, feel free to open a [support issue][6]. node-http-proxy is designed to just proxy http requests from one server to another, but we will be soon releasing many other complimentary projects that can be used in conjunction with node-http-proxy.
313
368
314
369
## Run Tests
370
+
The test suite is designed to fully cover the combinatoric possibilities ofHTTP and HTTPS proxying:
0 commit comments