ngx_http_proxy_connect_module
ngx_http_proxy_connect_module copied to clipboard
windows1.18.0 HTTPS Received HTTP code 0 from proxy after CONNECT
It took me several days to compile windows nginx 1.18.0, but the operation reported an error. Please help me. If there is the same issue, please tell me, I can't find it. Thank you
patch -bp1 < proxy_connect_rewrite_1018.patch
auto/configure --with-cc=cl
--builddir=build
--prefix=
--conf-path=conf/nginx.conf --pid-path=logs/nginx.pid
--http-log-path=logs/access.log --error-log-path=logs/error.log
--sbin-path=nginx.exe
--http-client-body-temp-path=temp/client_body_temp
--http-proxy-temp-path=temp/proxy_temp
--http-fastcgi-temp-path=temp/fastcgi_temp
--with-cc-opt=-DFD_SETSIZE=1024
--with-pcre=src/build/lib/pcre
--with-zlib=src/build/lib/zlib
--with-openssl=src/build/lib/openssl
--with-select_module
--with-http_ssl_module
--with-http_sub_module
--add-module=src/build/lib/ngx_http_proxy_connect_module
nginx .conf
# main context
worker_processes auto;
events {
worker_connections 1024;
}
http {
#include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 3128;
# dns resolver used by forward proxying
resolver 8.8.8.8;
# forward proxy for CONNECT request
proxy_connect;
proxy_connect_allow 443 563;
proxy_connect_connect_timeout 10s;
proxy_connect_read_timeout 10s;
proxy_connect_send_timeout 10s;
# forward proxy for non-CONNECT request
location / {
proxy_pass http://$host;
proxy_set_header Host $host;
}
}
}
Error
[root@master1 ~]# curl https://www.baidu.com -svo /dev/null -x 192.168.9.177:3128
* About to connect() to proxy 192.168.9.177 port 3128 (#0)
* Trying 192.168.9.177...
* Connected to 192.168.9.177 (192.168.9.177) port 3128 (#0)
* Establish HTTP proxy tunnel to www.baidu.com:443
> CONNECT www.baidu.com:443 HTTP/1.1
> Host: www.baidu.com:443
> User-Agent: curl/7.29.0
> Proxy-Connection: Keep-Alive
>
* Recv failure: Connection reset by peer
* Received HTTP code 0 from proxy after CONNECT
* Connection #0 to host 192.168.9.177 left intact
please help me.
thank you !
hi @2777484478
This project is not tested on windows. If you can enable debug log of nginx, we can try to debug this request.
From the message from curl, we can know that ur connection to nginx is not established. It may be that ur nginx crashed or ur nginx did not start.
Recv failure: Connection reset by peer
Nginx didn't seem to crash and started normally. Because it seems normal to request HTTP, but HTTPS is not allowed
Cannot debug with currenty information you provided.
You can configured nginx with --with-debug, and config error_log to debug level. Then log the debug log from error.log with this failed request.
For how to enable debug log, see http://nginx.org/en/docs/debugging_log.html
This issue may be fixed in https://github.com/chobits/ngx_http_proxy_connect_module/pull/248. Note that only nginx-1.17.x ~ nginx-1.23.2 have been fixed. Their corresponding patch is proxy_connect_rewrite_1018.patch and proxy_connect_rewrite_102101.patch.