0

I'm sorry for the beginner question but I've spent a long time trying to get this to work properly with no luck.

I have a location block to redirect https://my.domain.com/foo to https://192.168.1.25, which hosts a webapp. When you get to the webapp, the webapp automatically redirects you to https://192.168.1.25/login to log in. When typing in the local IP (https://192.168.1.25) this redirect happens as expected.

When I visit https://my.domain.com/foo, it redirects to https://my.domain.com/login instead of https://my.domain.com/foo/login and I cannot figure out why. This leads to a 404 error.

Here is the relevant section of my nginx.conf file:

 server { listen 80; server_name my.domain.com; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name my.domain.com; include ssl_my_domain.conf; location /foo/ { proxy_pass https://192.168.1.25/; } } 

As far as I'm aware, setting trailing slashes in the location block (/foo/ and 192.168.1.25/) should work (as in the responses in Nginx Redirect via Proxy, Rewrite and Preserve URL and elsewhere) but it's just not redirecting properly.

Any help is appreciated.

3
  • I think this is a bad handling of the anonymous webbapp Commented Jun 23, 2022 at 4:13
  • Your backend needs to be configured with the correct base url. Commented Jun 23, 2022 at 7:29
  • Does this answer your question? How can I forward requests from my web server? Commented Jun 23, 2022 at 7:29

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.