location ~ ([a-zA-Z0-9-]+\.(jpg|jpeg|png|gif|webp|bmp|avif))$ {
proxy_pass http://sfs-filer:8888/$1;
proxy_set_header Host $host;
}
请注意,请注意,在Proxy_pass中,请不要完全更改域,如第一个示例中,它保持1比1。这怎么可能?解析器为什么取决于正则表达式?
Yes, I can add
resolver 127.0.0.11 valid=10s;
and it will work. But the essence of it is an absolute mystery to me.
my own answer当您的指令参数包括变量时,NGINX并不能像通常一样在启动时间解析您的上游IP,但是在请求处理过程中尝试执行此操作,因此需要定义的解析器。您的问题几乎是相同的。 I have
there too, showing how the problem can be solved without using the
proxy_pass
directive.唯一的区别是您使用的是REGEX位置,并且您需要命名捕获以使用相同的技术,因为在指令执行期间,任何编号的捕获都会被覆盖:
proxy_pass