使用proxy\u重定向指令重写nginx位置头

使用proxy\u重定向指令重写nginx位置头,nginx,http-redirect,http-status-code-303,Nginx,Http Redirect,Http Status Code 303,使用以下nginx.conf在windows上作为反向代理运行nginx http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8082; server_name localhost;

使用以下nginx.conf在windows上作为反向代理运行nginx

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       8082;
        server_name  localhost;

        location / {
            proxy_pass http://192.168.12.211:8082;
            proxy_redirect http://192.168.12.211/ http://localhost:8080/;
            proxy_set_header   Host $host;
        }
    }
}
这是卷曲的o/p

c:\curl>curl -I http://localhost:8082
HTTP/1.1 303 See Other
Server: nginx/1.9.9
Date: Wed, 20 Jan 2016 10:30:38 GMT
Content-Type: text/html
Connection: keep-alive
Access-Control-Allow-Origin: *
location: http://192.168.12.211:8080/test.htm?Id=12345678
我希望响应中接收到的“
location
”头被重写,如nginx.conf文件中的
proxy\u redirect
指令所示。基本上

地点:

必须重写为

地点:


在nginx配置中我遗漏了什么?非常感谢您的提示。

您应该在代理重定向的第一个参数中包含端口号。@AlexeyTen:谢谢,也尝试过了,但没有帮助。位置标头根本没有改变(有或没有端口)。您找到解决此问题的方法了吗?