【发布时间】:2020-07-13 13:26:23
【问题描述】:
如果你愿意,伙计们,帮我解决这个问题 我想要访问这个 URL 的人 https://123.com/storage/app/profiles/Ar.BB_1585493889.png?w=200&h=200
最后的参数是w=和h= 只有当 URL 与两个参数 w= 和 h= 相关联时,才能将代理传递给他。 我试图这样做,但它不起作用
> $1 = for the file name which is Ar.BB_1585493889.png
> $2 = for width(w=)
> $3 = for height (h=)
location ~* ^/storage/app/profiles/(.*)?w\=(.*)\&h\=(.*) {
proxy_pass http:/123.com:8888/unsafe/$2x$3/smart/https://123.com/storage/app/profiles/$1;
}
非常感谢您的帮助。
【问题讨论】:
-
您无法使用
location指令捕获查询字符串(?之后的任何内容)。您可以改用$arg_w和$arg_h。 -
谢谢@RichardSmith,非常感谢您的帮助,请您帮我传递三个参数,其中一个是文件名,我在这里看到了这个问题,但不知道了解如何将其应用于我的。 stackoverflow.com/questions/8130692/…
-
我希望这个 123.com/storage/app/profiles/… 代理传递给这个 http://123.com:8888/unsafe/$2x$3/smart/123.com/storage/app/profiles/$1
标签: nginx nginx-reverse-proxy nginx-location