I have a Django app, and recently I need to run a beta. I want the current running application not to touch, and the redirection of all requests starts with "/ beta" in the beta application using Nginx. Here is my conf
location / { proxy_pass_header Server; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 10; proxy_read_timeout 360; proxy_pass http://localhost:8000/; } location /beta/ { rewrite ^/beta/(.*)$ /$1 break; proxy_pass_header Server; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 10; proxy_read_timeout 360; proxy_pass http://localhost:8001/; }
This works, but there is a problem when the application returns a 301 response, basically when the user needs to log in to access some resource, the URL becomes old.
For example, if /events login is required.
http://example.com/beta/events → http://example.com/login?next=/events/
How can I fix this without changing the application code? (Nginx solution?)
source share