Replies: 4 comments
-
If you think it's an bug; Can you provide a minimal working reproduction? |
Beta Was this translation helpful? Give feedback.
-
https://codesandbox.io/s/http-proxy-middleware-forked-w6fvni?file=/src/index.js I've made a sandbox here but I'm not sure when the actual disconnection occurs or if the sandbox will be able to catch it because it looks like the sandbox "server" reboots every now and then? So the issue is that when my express app starts up it is able to connect and I'm able to use ttyd well through the reverse proxy but after a while, the wss part just throws a 404 even though it was working for a while |
Beta Was this translation helpful? Give feedback.
-
This is my setup now, I simplified it to just one route which is /ttyd const ttydProxy = createProxyMiddleware({
target: `https://${getLocalIP()}:4443/ttyd`,
changeOrigin: true,
ws: true,
secure: false,
logLevel: 'debug',
pathRewrite: {
'^/ttyd': ''
},
onProxyReq: function(proxyReq, req, res) {
//console.log('path', req.path)
console.log('url', req.url)
}
}) app.use('/ttyd', [ensureAuthenticated, ttydProxy]) Then I initialize the express app using spdy.createServer(sslOptions, app).listen(PORT, () => {
logger.info(`app server listening on port ${PORT}`)
}); I have a bunch of other stuff in EDIT: it did stop working again and I see these in my syslogs:
|
Beta Was this translation helpful? Give feedback.
-
I fixed it by removing |
Beta Was this translation helpful? Give feedback.
-
Checks
http-proxy-middleware
.Describe the bug (be clear and concise)
I have an instance of ttyd that is already reverse proxied by nginx at the URL
https://192.168.1.1:4443/ttyd
and that is available and functional when I visit it. My end goal is to have this instance in an iframe in one of my web applications that uses node.js and express as the web framework.This is how I create the proxy:
And I use it with the express app like this:
Everything works well, atleast for a few minutes i.e before my browser starts showing this in the console with the iframe in question:
I'm not sure if it's something to do with my setup or something else entirely, would love some pointers in the right direction if it is indeed my fault
Step-by-step reproduction instructions
Try with the config I've mentioned in the description that should be able to reproduce the issue
Expected behavior (be clear and concise)
Websocket should be able to connect even after a long period of inactivity
How is http-proxy-middleware used in your project?
What http-proxy-middleware configuration are you using?
What OS/version and node/version are you seeing the problem?
Additional context (optional)
No response
Beta Was this translation helpful? Give feedback.
All reactions