Hi,
When proxying to https, ie:
var myProxy = httpProxyMiddleware('/my-path', {target: 'https://mysslexample.com'});
I first get a 'Proxy created' message, but then when I try to go to /my-path, I get the following error:
[HPM] Proxy error: undefined mysslexample.com/my-path
and nothing works. It works in Node 0.10.33, but not in Node 0.12. Is this an http-proxy-middleware issue or an http-proxy issue?
Thanks!
btw, /my-path is on a local domain that is not https.
Don't think it is an issue of the middleware.
Looking at the http-proxy proxy-http-to-https.js example, you'll need to configure the agent option:
var https = require('https');
var myProxy = httpProxyMiddleware('/my-path', {
target: 'https://mysslexample.com',
agent : https.globalAgent // <-- agent
});
ahh thanks for pointing me to that example. i also needed to set the host header as in that example in order for it to work, but it now does work!
@chimurai thanks for the agent tips, and thanks to @noahgrant for the host header information.
Most helpful comment
Don't think it is an issue of the middleware.
Looking at the http-proxy proxy-http-to-https.js example, you'll need to configure the
agentoption: