参数nginx重写请求正则表达式

时间:2013-07-30 13:40:25

标签: nginx proxy location reverse-proxy pcre

服务器编号1接收http://server111.com/box_example/?boo=test&too=best之类的请求,并将代理重写请求(如http://server222.com/u=box_example&?boo=test&too=best)接收到服务器编号2

我在这里尝试的是选择:

location ~*/ {
   rewrite  ^/([a-z0-9])$   u=box_example&?boo=test&too=best break;
   rewrite  ^/(~*[a-z0-9])$ u=box_example&?boo=test&too=best break;
...
proxy_pass         http://192.168.200.9:3000;

请告诉我怎么做。

1 个答案:

答案 0 :(得分:0)

试试这个:

location / {
    rewrite ^/(.*)/$ /?u=$1&$args break;
    ...
    proxy_pass         http://192.168.200.9:3000;
相关问题