I have a nodejs application running using express on my localhost. I use bootstrap as well. The problem is that at my workplace I have to use proxy settings. Once I type localhost:3000 it gets redirected to an IP address that does not run. If I remove the proxy settings from Google Chrome localhost:3000 works some of the times but without the bootstrap styling.
I am also using routes to direct different urls to the corresponding ejs pages:
router.get('/', function(req, res, next) {
res.render('index', {});
});
The index.ejs file has a URL pointing to the bootstrap css online remote file.
Is there a way to have it running using the proxy as well.
Thank you in advance :)
Use module http-proxy
npm install http-proxy
It is then possible to proxy requests by calling these functions
const httpProxy = require('http-proxy');
//
// Create your proxy server and set the target in the options.
//
httpProxy.createProxyServer({ target:'http://192.168.126.128:8080' }).listen(9000);
For more information visit https://github.com/nodejitsu/node-http-proxy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With