I have two node servers running on ports 3000 and 4000. If I had NGINX running and pointed ngrok at it, is there a way I can redirect requests from ngrok subfolders to each node server? eg abc123.nrgok.io/a goes to port 3000, abc123.ngrok.io/b goes to port 4000. There are several routes for each node server and some static html files too.
In the end I scrapped NGINX and instead ran a third node server which just had http-proxy-middleware running. That seemed to work much better but I did need to change the links in both apps to point at the sub folder and then rewrite the head in the new Node server (eg all the links went from style.css to /serverOne/style.css and then the proxy middleware strips off the /serverOne bit). Code below for the third Node server.
const http = require('http'),
express = require('express'),
{ createProxyMiddleware } = require('http-proxy-middleware')
const app = express()
app.use('/serverOne', createProxyMiddleware({target:'http://localhost:4000', changeOrigin: true, pathRewrite: {'^/serverOne' : '/'}}))
app.use('/serverTwo', createProxyMiddleware({target:'http://localhost:3000', changeOrigin: true, pathRewrite: {'^/serverTwo' : '/'}))
app.listen(2000);