在 nginx 中拆分 request_uri

Split request_uri in nginx

我是 Nginx 的新手,我正在尝试为 URL 的特定格式做 proxy_pass。

例如“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”。

同步后是否有拆分和获取参数的选项,

建议或解决方案表示赞赏

通过从 url

中删除 /sync/ 重写 url
location / {
             rewrite ^/sync/(.*) / break;
             proxy_pass http://localhost:8000;
           }