简体   繁体   English

在Nginx中拆分request_uri

[英]Split request_uri in nginx

I'm new to Nginx, I'm trying to do proxy_pass for a specific format of URL. 我是Nginx的新手,我正在尝试为特定的URL格式做proxy_pass。

For example " http://example.com/sync/test " is the URL accessed by the user, internally the URL has to do proxy_passs to apache server like, " http://localhost:8000/test " need to exclude sync, but now it's` redirecting has " http://localhost:8000/sync/test ". 例如,“ http://example.com/sync/test ”是用户访问的URL,在内部该URL必须对apache服务器执行proxy_pass,例如“ http:// localhost:8000 / test ”需要排除同步,但现在它的重定向具有“ http:// localhost:8000 / sync / test ”。

Is there any option to split and get parameters after sync, 同步后是否有任何拆分和获取参数的选项,

Suggestions or solution is appreciated 建议或解决方案表示赞赏

Rewrite the url by removing /sync/ from the url 通过从网址中删除/sync/来重写网址

location / {
             rewrite ^/sync/(.*) /$1 break;
             proxy_pass http://localhost:8000;
           }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM