nginx url 路径中有 # 号

瞎测试,居然可以,记录一下

路径里面有#号特殊字符,好像不行,重写下url好像可以访问。

原地址是 http://xxxxxxx/index.xhtml#/xxxx 里面有#号

用新的地址变成 http://xxxxxxx/test#/xxxx 

location ^~ /test {
        rewrite ^/index.xhtml#/(.*)$  /$1 break;
            proxy_pass   http://xxxxxxx:8002/index.xhtml#/;
            proxy_redirect         off;
              proxy_set_header       Host             $host;
              proxy_set_header       X-Real-IP        $remote_addr;
              proxy_set_header       X-Forwarded-For  $proxy_add_x_forwarded_for;
       }


    location / {
        set $flag 0;

        if ($http_referer ~ test) {
            set $flag "${flag}1";
        }        
        if ($flag = "01") {
            proxy_pass http://xxxxxxxx:8002;
        }
        

        proxy_redirect         off;
        proxy_set_header       Host             $host;
        proxy_set_header       X-Real-IP        $remote_addr;
        proxy_set_header       X-Forwarded-For  $proxy_add_x_forwarded_for;


        }

你可能感兴趣的:(解决问题,nginx)