fix(all): Back router.

This commit is contained in:
me@rodrigorodriguez.com 2024-10-28 10:11:49 -03:00
parent 5590460000
commit 2cc6a63121

View file

@ -283,17 +283,15 @@ export class GBServer {
} else { } else {
// Setups unsecure http redirect. // Setups unsecure http redirect.
const proxy = httpProxy.createProxyServer({}); const proxy = httpProxy.createProxyServer({});
GBLogEx.verbose(0, `Redirecting... ${req.originalUrl}`);
if (host === process.env.API_HOST) { if (host === process.env.API_HOST) {
GBLogEx.info(0, `Redirecting to API...`);
return proxy.web(req, res, { target: 'http://localhost:1111' }); // Express server return proxy.web(req, res, { target: 'http://localhost:1111' }); // Express server
} else if (host === process.env.ROUTER_1) { } else if (host === process.env.ROUTER_1) {
GBLogEx.info(0, `Redirecting...`); return proxy.web(req, res, { target: `http://localhost:${process.env.ROUTER_1_PORT}` });
return proxy.web(req, res, { target: `http://localhost:${process.env.ROUTER_1_PORT}` }); // Express server
} else if (host === process.env.ROUTER_2) { } else if (host === process.env.ROUTER_2) {
GBLogEx.info(0, `Redirecting...`); return proxy.web(req, res, { target: `http://localhost:${process.env.ROUTER_2_PORT}` });
return proxy.web(req, res, { target: `http://localhost:${process.env.ROUTER_2_PORT}` }); // Express server
} else { } else {
await GBSSR.ssrFilter(req, res, next); await GBSSR.ssrFilter(req, res, next);
} }