How can query string parameters be forwarded through a proxy_pass with nginx?

前端 未结 7 1509
Happy的楠姐
Happy的楠姐 2020-11-27 10:26
upstream apache {
   server 127.0.0.1:8080;
}
server{
   location ~* ^/service/(.*)$ {
      proxy_pass http://apache/$1;
      proxy_redirect off;
   }
 }
         


        
7条回答
  •  我在风中等你
    2020-11-27 10:42

    To redirect Without Query String add below lines in Server block under listen port line:

    if ($uri ~ .*.containingString$) {
               return 301 https://$host/$uri/;
    }
    

    With Query String:

    if ($uri ~ .*.containingString$) {
               return 301 https://$host/$uri/?$query_string;
    }
    

提交回复
热议问题