I have a client with an existing domain name which cannot be pointed to my server just yet.

So in the meanwhile I've added my node app and configuring the reverse proxy. This is what I've done:

1) Added domain entries to my local machine's hosts file: example.com www.example.com

2)on my server hosts file, I did the same: example.com www.example.com

3) My nginx reverse proxy setup. This is my /etc/nginx/sites-available/default file:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;
    index index.php index.js index.html index.htm index.nginx-debian.html;

    server_name example.com www.example.com;

    location / {
    proxy_pass http://localhost:8000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;

Now what happens if I visit any subpath, like http://example.com/products, everything works fine.

But, when I visit root http://example.com - contents are served as expected, but the address in my browser address bar changes to .

Looking at devtools network tab, I see that initiator is example.com, but in the request headers host is actually (not example.com).

Is any of what I've done above causing this? Or should I be digging up my app? So far I'm not finding any cause inside the app.

EDIT: it appears that this only happens in google chrome. Is this expected behavior from chrome?

  • There's nothing in the nginx configuration to cause this. You should keep looking at your app. – Michael Hampton Apr 6 at 20:13
  • @MichaelHampton I just noticed that it only happens on google chrome. Other browsers are fine. I have no SSL set up, I'm thinking it could have something to do with it maybe. – geochanto Apr 6 at 20:14
  • Did you clear your browser cache? – Michael Hampton Apr 6 at 20:42
  • @MichaelHampton yes. The strange thing is that it ONLY happens in incognito mode lol. I guess it's not much of a problem after all. – geochanto Apr 6 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.