ngx_http_proxy_connect_module icon indicating copy to clipboard operation
ngx_http_proxy_connect_module copied to clipboard

proxy_connect: upstream read timed out (peer:40.xxx.xx.xxx:443) while connecting to upstream

Open sbadyjy opened this issue 4 years ago • 3 comments

Ⅰ. Issue Description

When an https request comes in, an access.log and an error.log will be generated, but the request and response are normal.

Ⅱ. Describe what happened

Ⅲ. Describe what you expected to happen

The https request comes in, when the request and response are normal, the errror log will not appear

Ⅳ. How to reproduce it (as minimally and precisely as possible)

1.access.log

10.135.8.144 - - [28/Apr/2021:14:07:20 +0800] "CONNECT phtcam.xxxxx.com:443 HTTP/1.1" 200 4784 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_191)"
10.135.8.144 - - [28/Apr/2021:14:07:20 +0800] "CONNECT phtcam.xxxxx.com:443 HTTP/1.1" 200 4784 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_191)"
10.135.8.144 - - [28/Apr/2021:14:07:20 +0800] "CONNECT phtcam.xxxxx.com:443 HTTP/1.1" 200 4784 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_191)"
10.135.8.144 - - [28/Apr/2021:14:07:20 +0800] "CONNECT phtcam.xxxxx.com:443 HTTP/1.1" 200 4784 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_191)"
10.135.8.144 - - [28/Apr/2021:14:07:20 +0800] "CONNECT phtcam.xxxxx.com:443 HTTP/1.1" 200 4784 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_191)"

2.error.log

2021/04/28 14:07:20 [error] 68744#0: *10 proxy_connect: upstream read timed out (peer:40.xxx.xx.xxx:443) while connecting to upstream, client: 10.135.8.144, server: , request: "CONNECT phtcam.xxxxx.com:443 HTTP/1.1", host: "phtcam.xxxxx.com"
2021/04/28 14:07:20 [error] 68743#0: *12 proxy_connect: upstream read timed out (peer:40.xxx.xx.xxx:443) while connecting to upstream, client: 10.135.8.144, server: , request: "CONNECT phtcam.xxxxx.com:443 HTTP/1.1", host: "phtcam.xxxxx.com"
2021/04/28 14:07:20 [error] 68743#0: *15 proxy_connect: upstream read timed out (peer:40.xxx.xx.xxx:443) while connecting to upstream, client: 10.135.8.144, server: , request: "CONNECT phtcam.xxxxx.com:443 HTTP/1.1", host: "phtcam.xxxxx.com"
2021/04/28 14:07:20 [error] 68742#0: *18 proxy_connect: upstream read timed out (peer:40.xxx.xx.xxx:443) while connecting to upstream, client: 10.135.8.144, server: , request: "CONNECT phtcam.xxxxx.com:443 HTTP/1.1", host: "phtcam.xxxxx.com"
2021/04/28 14:07:20 [error] 68742#0: *21 proxy_connect: upstream read timed out (peer:40.xxx.xx.xxx:443) while connecting to upstream, client: 10.135.8.144, server: , request: "CONNECT phtcam.xxxxx.com:443 HTTP/1.1", host: "phtcam.xxxxx.com"

3.nginx.conf

worker_processes 10;
events {
worker_connections 10240;
}

http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /home/stq/nginx/logs/access.log main;
error_log /home/stq/nginx/logs/error.log;
sendfile on;
#tcp_nopush on;
#tcp_nodelay on;
keepalive_timeout 60s;

server {
listen 8888;
resolver 223.5.5.5;
proxy_connect;
proxy_connect_allow 443 563;
proxy_connect_connect_timeout 10s;
proxy_connect_read_timeout 10s;
proxy_connect_send_timeout 10s;
#access_log logs/host.access.log main;
#proxy_ignore_client_abort on;
client_body_timeout 3600s;

location / {
#proxy_pass https://$host$request_uri;
proxy_pass http://$host;
#proxy_pass $scheme://$http_host$request_uri;
proxy_set_header Host $host;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Real-IP $remote_port;
#proxy_pass https://$host$request_uri;
#proxy_ssl_server_name on;
}
#location / {
# proxy_pass $scheme://$http_host$request_uri;
#}

}

}

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  1. Tengine/Nginx/OpenResty version (use sbin/nginx -v):
  2. Which patch do you use? nginx 1.20 ngx_http_proxy_connect_module 1018

sbadyjy avatar Apr 28 '21 06:04 sbadyjy

same issue in 1.19.1... and logging is too slow.

malza321 avatar Jun 10 '21 03:06 malza321

Link to #175.

Similar issue.

I have understood the problem, but I need to consider how to set right timer and some new instructions or variables. Here, the timer setting have some works and needs more testing.

chobits avatar Jul 03 '21 04:07 chobits

I have the same problem like this,but I don't know how to solve it.The version of my nginx is "1.20.1",“time_out” is set to 120s.

wskyhawk avatar Nov 25 '21 02:11 wskyhawk

@chobits 我目前也遇到这个问题了,现在还没有修复吗?

huangyuewu avatar Nov 23 '22 07:11 huangyuewu

你好!你的邮件已经收到,我会尽快给你回复,谢谢!

wskyhawk avatar Nov 23 '22 07:11 wskyhawk

hi @huangyuewu huangyuewu

@chobits 我目前也遇到这个问题了,现在还没有修复吗?

It has been fixed in for_pull_request branch. check it out in https://github.com/chobits/ngx_http_proxy_connect_module/tree/for_pull_request

已经在 for_pull_request branch分支中修复

chobits avatar Nov 24 '22 13:11 chobits

has been fixed since v0.0.4

chobits avatar Jun 20 '23 14:06 chobits

你好!你的邮件已经收到,我会尽快给你回复,谢谢!

wskyhawk avatar Jun 20 '23 14:06 wskyhawk