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

前端 未结 7 1510
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条回答
  •  猫巷女王i
    2020-11-27 10:39

    I modified @kolbyjack code to make it work for

    http://website1/service
    http://website1/service/
    

    with parameters

    location ~ ^/service/?(.*) {
        return 301 http://service_url/$1$is_args$args;
    }
    

提交回复
热议问题