我想了解为什么会发生这种情况。当我在没有正则表达式的情况下使用proxy_pass时,一切都很棒,dns就可以解决,等等。

问题描述 投票:0回答:0

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.

当您的指令参数包括变量时,NGINX并不能像通常一样在启动时间解析您的上游IP,但是在请求处理过程中尝试执行此操作,因此需要定义的解析器。您的问题几乎是相同的。 I have
my own answer
 there too, showing how the problem can be solved without using the 
proxy_pass

directive.唯一的区别是您使用的是REGEX位置,并且您需要命名捕获以使用相同的技术,因为在指令执行期间,任何编号的捕获都会被覆盖: proxy_pass


docker nginx docker-compose nginx-config nginx-location
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.