In development we often deal with dev. servers which have self-signed SSL certificate. If I use --proxy option pointing to such a server - I get following error upon proxy attempt:
node_modules/http-proxy/lib/http-proxy/index.js:119
throw err;
^
Error: SELF_SIGNED_CERT_IN_CHAIN
at SecurePair.<anonymous> (tls.js:1381:32)
at SecurePair.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:980:10)
at CleartextStream.read [as _read] (tls.js:472:13)
at CleartextStream.Readable.read (_stream_readable.js:341:10)
at EncryptedStream.write [as _write] (tls.js:369:25)
at doWrite (_stream_writable.js:226:10)
at writeOrBuffer (_stream_writable.js:216:5)
at EncryptedStream.Writable.write (_stream_writable.js:183:11)
at write (_stream_readable.js:602:24)
This will not happen if you pass secure: false option to httpProxy.createProxyServer. You can do it by default or enable with some option. I can compose a pull request if you like.
This is sooooo needed fix - especially if I'm using this for proxying in development where I have multiple backends and all of them with self signed cert.
What will be good is to have support for more then proxy backend - same as proxyPass directive in Apache.
Any news on this ?
In my mac I did the following hack (Because I have no time to make a PR)
npm install -g http-serverhttp-server.js located in (my mac) /usr/local/lib/node_modules/http-server/lib/http-server.js. I installed node via homebrewsecure: false option like this: var proxy = httpProxy.createProxyServer({secure: false});Caveats: This is a developer's solution to a developer's problem. You should not make this change in a production environment or something like that. I personally would set this as a cli config parameter.
Most helpful comment
In my mac I did the following hack (Because I have no time to make a PR)
npm install -g http-serverhttp-server.jslocated in (my mac)/usr/local/lib/node_modules/http-server/lib/http-server.js. I installed node via homebrewsecure: falseoption like this:var proxy = httpProxy.createProxyServer({secure: false});Caveats: This is a developer's solution to a developer's problem. You should not make this change in a production environment or something like that. I personally would set this as a cli config parameter.