Nginx Nginx rewrite 生成规则的问题 (URL 为 post 接口)

zqalyc · 2014年08月14日 · 最后由 skylothar 回复于 2014年08月23日 · 12302 次阅读

访问:

http://www.kangbing.com/blood/create/show/infor/123?id=123(post接口)

转发到:

http://www.kangbing.com/blood/create?id=123(post接口)

nginx rewrite 配置:

location /blood/create{
 rewrite  ^/create/(.*)$  /create  permanent;
 #rewrite  ^/(.*)/create/(.*)$  /$1/create  permanent;
}

shell rewrite ^/(.*)/create/(.*)$ /$1/create permanent;能够转发到:shell http://www.kangbing.com/blood/create?id=123但是接口变为 get 请求了。 用 shellrewrite ^/create/(.*)$ /create permanent;不起作用

需要怎么修改?

permanent 是做 301。自然会变成 get. 你用 proxy_pass 就好了

proxy_pass http://www.kangbing.com/blood/create?$args

需要 登录 后方可回复, 如果你还没有账号请 注册新账号