chobits / ngx_http_proxy_connect_module

A forward proxy module for CONNECT request handling
BSD 2-Clause "Simplified" License
1.81k stars 493 forks source link

How to config proxy_connect module without `resolver` directive? /// 怎么能不写resolver使用这个模块 #234

Closed wi162yyxq closed 1 year ago

wi162yyxq commented 2 years ago

因为项目要求不允许在配置文件中写resolver,请问如何不写resolver的情况下使得这个模块可以找到代理解析域名地址。

chobits commented 2 years ago

For example (no resolver configured), see this server{} block in our test case. Note that proxy_address_bind may be useless for your case.

Make sure you know how proxy_connect_address works. Its doc: https://github.com/chobits/ngx_http_proxy_connect_module#proxy_connect_address

wi162yyxq commented 2 years ago

您方便发一个没有resolver的配置模板吗,我尝试了一下使用address但是没有生效,日志还是显示需要resolver

chobits commented 2 years ago

hi 你好。你可能没有理解我上面发给你的那段信息。

这个模块如果你没有resolver,逻辑上就无法走通,比如你要代理到xx.com,如果你不配resolver的话,nginx将无法知道xx.com具体ip地址所以无法工作。

而我上一条回复的信息是告诉你,如果你有手段自己设置代理的后端ip而不需要nginx来resolver探测,那么你可以使用 proxy_connect_address 这个指令。


You may not have understood the message I sent you above.

If you do not have a resolver, this module will not work logically. For example, if you want to proxy to xx.com and do not have a resolver configured, nginx will not be able to know the specific IP address of xx.com, so it will not work.

And the information in my last reply is to tell you that if you have the means to set the backend IP of the proxy yourself , you can use the proxy_connect_address directive.