I have an application with Swagger on localhost:8080/swagger/
.
I need a redirect from localhost:80
to actual swagger url which is localhost:8080/swagger/
so I setup a Nginx reverse proxy:
server {
listen 80;
server_name=_;
location / {
proxy_pass http://localhost:8080/swagger/;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
So when I enter localhost:80
I recieve 301 code and redirect to localhost:80/swagger/index.html
. But I need port 8080
, why nginx ignores port in proxy_pass?