我有一个NGINX充当反向代理.我需要从URL中删除子串string_1,其余的URL是可变的.
例:
Origin: http://host:port/string_1/string_X/command?xxxxx
Destination: http://internal_host:port/string_X/command?xxxxx
nginx.conf:
location /string_1/ {
proxy_pass http://internal_host:port/$request_uri$query_string;
谢谢,
@pcamacho
最佳答案
我找到了重写proxy_pass URL的方法:
location /string_1/ {
if ($request_uri ~* "/string_1/(.*)") {
proxy_pass http://internal_host:port/$1;
}
}
问候,
@pcamacho
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。