We have our node application which we want to use to proxy jupyter notebook running on AWS EMR. I am able to proxy all my http request from my node application using http-proxy-middleware. But for some reason I am unable to proxy web-socket requests. Because of this I am able to create a new notebook but unable to start the kernel. Here is my proxy middleware
'use strict';
const proxy = require('http-proxy-middleware');
module.exports = proxy({
target: 'http://<EMR master_node IP>:<Port>',
ws: true,
changeOrigin: true,
// onProxyReq: (proxyReq, req, res) => {
// proxyReq.removeHeader('Upgrade');
// proxyReq.removeHeader('Connection');
// proxyReq.setHeader('Upgrade', 'websocket');
// proxyReq.setHeader('Connection', 'upgrade');
// },
secure: true,
loglevel: 'debug'
});
I tried to manually add the headers as well which you see as commented but it did not help. Also for the server application I have upgrade enabled.
server.on('upgrade', proxy.upgrade);
Any help would be greatly appreciated.