I have nginx working as a frontend to tornado (which is running an app based on Flask framework). Nginx is running on 8080 port. However when Flask generates a "301 redirect" it does not take into account the 8080 port. I get a redirect to 80 port, where I have nothing listening.
This is my nginx config for the site:
server {
listen 8080;
server_name localhost;
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
expires off;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Port 8080;
proxy_pass http://127.0.0.1:5000;
}
}
Is there a way to correct the problem?