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

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

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -