Closed benjhoo closed 8 years ago
I finally found a solution : forcing the x-forwarded-host in browser sync config seems to work.
browserSync.init({
...
proxy: {
target: "http://my-app.local:3000",
reqHeaders: function(config) {
return {
"accept-encoding": "identity",
"agent": false
};
},
middleware: function(req, res, next) {
res.setHeader("X-Forwarded-Host", req.headers.host);
next();
}
}
});
If it could help someone.
Regards
Hi,
I'm using browser-sync to automatically reload my browser in dev env when I modify my sources. To do that, my app is launched via nodemon on a certain port number (ex: 3000) as a proxy, and then browser-sync is launched, pointing to this proxy url with an other port number (ex: 5000).
http://my-app.local:5000 ==> http://my-app.local:3000
The problem is when I log in my app with the passport-cas module, service url is fixed to the initial url (http://my-app.local:3000). So, once authenticated, the CAS service redirect to the original node app and I loose the Browser-Sync benefits.
Is there a possibility to get the right port number in service URL ? Or maybe it could be useful to have a service option to precise the callback url.
Thanks.