Home > Software engineering >  Webapp reachable via domain but not working
Webapp reachable via domain but not working

Time:10-18

My NextJs application is reachable under https://xyz.pizza/ but doesn't work. For example, if you search for degods, nothing happens when pressing enter.

BUT if you go to the site via http://65.21.252.133:3000/ or http://xyz.pizza:3000/ then everything works fine.

I have completely no idea what causes this issue. The source code of the project is on GitHub: https://github.com/basti394/nft-research It's hosted on Hetzner Cloud and runs on NodeJs with Tmux.

My Nginx config:

server { # simple reverse-proxy
   server_name  xyz.pizza www.xyz.pizza;

   location /neo4j {
      proxy_pass      http://127.0.0.1:7474/browser;
   }

   location = / {
      proxy_pass      http://127.0.0.1:3000;
   }

   listen 443 ssl; # managed by Certbot
   ssl_certificate /etc/letsencrypt/live/xyz.pizza/fullchain.pem; # managed by Certbot
   ssl_certificate_key /etc/letsencrypt/live/xyz.pizza/privkey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

If you need any more information then just ask :)

CodePudding user response:

It's probably due to a missing / at the end of the proxy_pass rule.

   location = / {
      proxy_pass      http://127.0.0.1:3000/;
   }

CodePudding user response:

I resolved the issue by removing the = from the location signature. I also tried it without the trailing / at http://117.0.0.1:3000 and it works as well.

So the location declaration in nginx.conf should look something like this:

location / {
   proxy_pass   http://127.0.0.1:3000/;
}
  • Related