Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep-alive option in webpack-dev-server with http-proxy-middleware?

We are using webpack-dev-server with http-proxy-middleware. Our Protractor test cases keep timing out. I suspect we need to have keep-alive set to true, but I don't see such an option either in webpack-dev-server nor in http-proxy-middleware. Is it possible to configure keep-alive for wepack-dev-server?

Thanks

like image 783
Anna T Avatar asked Oct 17 '25 13:10

Anna T


2 Answers

Yes, You can configure keep-alive in headers options like below. Use devServer.proxy.headers option.

devServer: {
    publicPath: '...',
    contentBase: '...',
    port: 9090,
    proxy: {
        '/**': {
            target: 'http://localhost:8080/',
            secure: false,
            changeOrigin: true,
            headers: {
                Connection: 'keep-alive'
            }
        }
    },
    open: true,
    inline: true,
    hot: false
}
like image 160
Younghun Jung Avatar answered Oct 19 '25 04:10

Younghun Jung


use Connection: 'Keep-alive', Make sure the first letter 'C' captialized, not the connection: 'keep-alive' whick ruined my whole day.

like image 24
xdu Avatar answered Oct 19 '25 03:10

xdu