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 - Autoloader issue not returning Class -

java - How to put two numbers separated by a space into two different arrays -

c++ - Why am i getting wrong values when performing PE base relocation? -