express - How to get req.hostname when running node.js behind apache with mod_proxy -


my node.js application uses req.hostname in order redirect pages http https this:

app.get('*', function(req, res){     res.redirect('https://' + req.hostname + req.url); }); 

this works when running application on localhost. when application runs on server behind mod_proxy req.hostname not contain domain name. instead contains localhost. how domain name?

on apache settings have add this:

proxypreservehost on 

this tell apache preserve hostname when doing proxy pass node application


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -