Skip to content

Commit d358084

Browse files
Radu Serbanescuchimurai
Radu Serbanescu
authored andcommitted
Add recipe for proxy to HTTPS servers (chimurai#206)
1 parent ca54580 commit d358084

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

recipes/https.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# HTTPS
2+
3+
How to proxy requests to various types of HTTPS servers.
4+
5+
All options are provided by [http-proxy](https://github.com/nodejitsu/node-http-proxy).
6+
7+
## Basic proxy to an HTTPS server
8+
9+
```javascript
10+
var proxy = require('http-proxy-middleware');
11+
12+
var apiProxy = proxy('/api', {
13+
target: 'https://example.org',
14+
changeOrigin: true,
15+
});
16+
```
17+
18+
## Proxy to an HTTPS server using a PKCS12 client certificate
19+
20+
```javascript
21+
var fs = require('fs');
22+
var proxy = require('http-proxy-middleware');
23+
24+
var apiProxy = proxy('/api', {
25+
target: {
26+
protocol: 'https:',
27+
host: 'example.org',
28+
port: 443,
29+
pfx: fs.readFileSync('path/to/certificate.p12'),
30+
passphrase: 'password',
31+
},
32+
changeOrigin: true,
33+
});
34+
```

0 commit comments

Comments
 (0)