Reputation: 7451
I've create a Browsersync proxy using http-proxy-middleware
like this:
var proxyMiddleware = require('http-proxy-middleware');
var proxy = proxyMiddleware('/api', {
target: 'https://xxx.xxx.xxx.xxx/api',
changeOrigin: true // for vhosted sites, changes host header to match to target's host
});
When the server starts it creates the proxy:
[HPM] Proxy created: /api -> https://xxx.xxx.xxx.xxx/api
However because the development API uses a self signed cert it throws the following error when the API gets called.
[HPM] Proxy error: DEPTH_ZERO_SELF_SIGNED_CERT. undefined -> "xxx.xxx.xxx.xxx/api"
Is there a way to disable this ?
Upvotes: 4
Views: 3576
Reputation: 81
Yes you should pass secure: false flag
var proxy = proxyMiddleware('/api', {
target: 'https://xxx.xxx.xxx.xxx/api',
changeOrigin: true,
secure: false
});
Upvotes: 4