<div dir="ltr">Hi Sergey,<div><br></div><div>Thank you for lending a hand!</div><div><br></div><div>I have enabled debug and here are two different calls to the backend:</div><div><br></div><div>1. It worked (The nginx config contains a hard-coded "Connection Upgrade" and "Upgrade Websocket" proxy_set_headers)</div><div><br></div><div>"2021/07/21 13:36:43 [debug] 1#1: bind() <a href="http://0.0.0.0:8060">0.0.0.0:8060</a> #6</div>2021/07/21 13:36:43 [debug] 1#1: bind() <a href="http://0.0.0.0:8063">0.0.0.0:8063</a> #7<br>2021/07/21 13:36:43 [notice] 1#1: using the "epoll" event method<br>2021/07/21 13:36:43 [debug] 1#1: counter: 00007F9A0E809080, 1<br>2021/07/21 13:36:43 [notice] 1#1: nginx/1.18.0<br>2021/07/21 13:36:43 [notice] 1#1: OS: Linux 4.14.239-1626564138<br>2021/07/21 13:36:43 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576<br>2021/07/21 13:36:43 [debug] 1#1: write: 8, 00007FFC29515792, 2, 0<br>2021/07/21 13:36:43 [debug] 1#1: setproctitle: "nginx: master process nginx-debug -c /usr/local/nginx/conf/nginx.conf -g daemon off;"<br>2021/07/21 13:36:43 [notice] 1#1: start worker processes<br>2021/07/21 13:36:43 [debug] 1#1: channel 3:8<br>2021/07/21 13:36:43 [notice] 1#1: start worker process 8<br>2021/07/21 13:36:43 [debug] 1#1: channel 9:10<br>2021/07/21 13:36:43 [debug] 8#8: add cleanup: 00007F9A0E80F8A8<br>2021/07/21 13:36:43 [debug] 8#8: malloc: 00007F9A0E89B090:8<br>2021/07/21 13:36:43 [notice] 1#1: start worker process 9<br>2021/07/21 13:36:43 [debug] 1#1: pass channel s:1 pid:9 fd:9 to s:0 pid:8 fd:3<br>2021/07/21 13:36:43 [debug] 1#1: channel 11:12<br>2021/07/21 13:36:43 [debug] 9#9: add cleanup: 00007F9A0E80F8A8<br>2021/07/21 13:36:43 [debug] 9#9: malloc: 00007F9A0E89B090:8<br>2021/07/21 13:36:43 [notice] 1#1: start worker process 10<br>2021/07/21 13:36:43 [debug] 1#1: pass channel s:2 pid:10 fd:11 to s:0 pid:8 fd:3<br>2021/07/21 13:36:43 [debug] 8#8: notify eventfd: 10<br>2021/07/21 13:36:43 [debug] 1#1: pass channel s:2 pid:10 fd:11 to s:1 pid:9 fd:9<br>2021/07/21 13:36:43 [debug] 8#8: eventfd: 11<br>2021/07/21 13:36:43 [debug] 1#1: channel 13:14<br>2021/07/21 13:36:43 [debug] 10#10: add cleanup: 00007F9A0E80F8A8<br>2021/07/21 13:36:43 [debug] 10#10: malloc: 00007F9A0E89B090:8<br>2021/07/21 13:36:43 [debug] 9#9: notify eventfd: 12<br>2021/07/21 13:36:43 [debug] 8#8: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:36:43 [debug] 9#9: eventfd: 13<br>2021/07/21 13:36:43 [debug] 8#8: malloc: 00007F9A0E88A450:6144<br>2021/07/21 13:36:43 [debug] 8#8: malloc: 00007F9A0DDCB460:237568<br>2021/07/21 13:36:43 [notice] 1#1: start worker process 11<br>2021/07/21 13:36:43 [debug] 8#8: malloc: 00007F9A0DDB2470:98304<br>2021/07/21 13:36:43 [debug] 9#9: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:36:43 [debug] 1#1: pass channel s:3 pid:11 fd:13 to s:0 pid:8 fd:3<br>2021/07/21 13:36:43 [debug] 1#1: pass channel s:3 pid:11 fd:13 to s:1 pid:9 fd:9<br>2021/07/21 13:36:43 [debug] 1#1: pass channel s:3 pid:11 fd:13 to s:2 pid:10 fd:11<br>2021/07/21 13:36:43 [debug] 9#9: malloc: 00007F9A0E88A450:6144<br>2021/07/21 13:36:43 [debug] 1#1: sigsuspend<br>2021/07/21 13:36:43 [debug] 9#9: malloc: 00007F9A0DDCB460:237568<br>2021/07/21 13:36:43 [debug] 8#8: malloc: 00007F9A0DD99480:98304<br>2021/07/21 13:36:43 [debug] 10#10: notify eventfd: 14<br>2021/07/21 13:36:43 [debug] 9#9: malloc: 00007F9A0DDB2470:98304<br>2021/07/21 13:36:43 [debug] 10#10: eventfd: 15<br>2021/07/21 13:36:43 [debug] 10#10: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:36:43 [debug] 9#9: malloc: 00007F9A0DD99480:98304<br>2021/07/21 13:36:43 [debug] 10#10: malloc: 00007F9A0E88A450:6144<br>2021/07/21 13:36:43 [debug] 10#10: malloc: 00007F9A0DDCB460:237568<br>2021/07/21 13:36:43 [debug] 10#10: malloc: 00007F9A0DDB2470:98304<br>2021/07/21 13:36:43 [debug] 8#8: epoll add event: fd:8 op:1 ev:00002001<br>2021/07/21 13:36:43 [debug] 8#8: setproctitle: "nginx: worker process"<br>2021/07/21 13:36:43 [debug] 8#8: worker cycle<br>2021/07/21 13:36:43 [debug] 8#8: epoll timer: -1<br>2021/07/21 13:36:43 [debug] 10#10: malloc: 00007F9A0DD99480:98304<br>2021/07/21 13:36:43 [debug] 8#8: epoll: fd:8 ev:0001 d:00007F9A0DDCB630<br>2021/07/21 13:36:43 [debug] 8#8: channel handler<br>2021/07/21 13:36:43 [debug] 8#8: channel: 32<br>2021/07/21 13:36:43 [debug] 9#9: epoll add event: fd:10 op:1 ev:00002001<br>2021/07/21 13:36:43 [debug] 8#8: channel command: 1<br>2021/07/21 13:36:43 [debug] 9#9: setproctitle: "nginx: worker process"<br>2021/07/21 13:36:43 [debug] 8#8: get channel s:1 pid:9 fd:3<br>2021/07/21 13:36:43 [debug] 9#9: worker cycle<br>2021/07/21 13:36:43 [debug] 9#9: epoll timer: -1<br>2021/07/21 13:36:43 [debug] 8#8: channel: 32<br>2021/07/21 13:36:43 [debug] 8#8: channel command: 1<br>2021/07/21 13:36:43 [debug] 8#8: get channel s:2 pid:10 fd:12<br>2021/07/21 13:36:43 [debug] 9#9: epoll: fd:10 ev:0001 d:00007F9A0DDCB630<br>2021/07/21 13:36:43 [debug] 9#9: channel handler<br>2021/07/21 13:36:43 [debug] 8#8: channel: 32<br>2021/07/21 13:36:43 [debug] 8#8: channel command: 1<br>2021/07/21 13:36:43 [debug] 9#9: channel: 32<br>2021/07/21 13:36:43 [debug] 8#8: get channel s:3 pid:11 fd:13<br>2021/07/21 13:36:43 [debug] 9#9: channel command: 1<br>2021/07/21 13:36:43 [debug] 9#9: get channel s:2 pid:10 fd:8<br>2021/07/21 13:36:43 [debug] 8#8: channel: -2<br>2021/07/21 13:36:43 [debug] 8#8: timer delta: 21<br>2021/07/21 13:36:43 [debug] 9#9: channel: 32<br>2021/07/21 13:36:43 [debug] 8#8: worker cycle<br>2021/07/21 13:36:43 [debug] 9#9: channel command: 1<br>2021/07/21 13:36:43 [debug] 8#8: epoll timer: -1<br>2021/07/21 13:36:43 [debug] 9#9: get channel s:3 pid:11 fd:9<br>2021/07/21 13:36:43 [debug] 10#10: epoll add event: fd:12 op:1 ev:00002001<br>2021/07/21 13:36:43 [debug] 9#9: channel: -2<br>2021/07/21 13:36:43 [debug] 10#10: setproctitle: "nginx: worker process"<br>2021/07/21 13:36:43 [debug] 9#9: timer delta: 21<br>2021/07/21 13:36:43 [debug] 10#10: worker cycle<br>2021/07/21 13:36:43 [debug] 9#9: worker cycle<br>2021/07/21 13:36:43 [debug] 10#10: epoll timer: -1<br>2021/07/21 13:36:43 [debug] 9#9: epoll timer: -1<br>2021/07/21 13:36:43 [debug] 10#10: epoll: fd:12 ev:0001 d:00007F9A0DDCB630<br>2021/07/21 13:36:43 [debug] 10#10: channel handler<br>2021/07/21 13:36:43 [debug] 10#10: channel: 32<br>2021/07/21 13:36:43 [debug] 10#10: channel command: 1<br>2021/07/21 13:36:43 [debug] 10#10: get channel s:3 pid:11 fd:8<br>2021/07/21 13:36:43 [debug] 10#10: channel: -2<br>2021/07/21 13:36:43 [debug] 11#11: add cleanup: 00007F9A0E80F8A8<br>2021/07/21 13:36:43 [debug] 10#10: timer delta: 21<br>2021/07/21 13:36:43 [debug] 10#10: worker cycle<br>2021/07/21 13:36:43 [debug] 10#10: epoll timer: -1<br>2021/07/21 13:36:43 [debug] 11#11: malloc: 00007F9A0E89B090:8<br>2021/07/21 13:36:43 [debug] 11#11: notify eventfd: 16<br>2021/07/21 13:36:43 [debug] 11#11: eventfd: 17<br>2021/07/21 13:36:43 [debug] 11#11: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:36:43 [debug] 11#11: malloc: 00007F9A0E88A450:6144<br>2021/07/21 13:36:43 [debug] 11#11: malloc: 00007F9A0DDCB460:237568<br>2021/07/21 13:36:43 [debug] 11#11: malloc: 00007F9A0DDB2470:98304<br>2021/07/21 13:36:43 [debug] 11#11: malloc: 00007F9A0DD99480:98304<br>2021/07/21 13:36:43 [debug] 11#11: epoll add event: fd:14 op:1 ev:00002001<br>2021/07/21 13:36:43 [debug] 11#11: setproctitle: "nginx: worker process"<br>2021/07/21 13:36:43 [debug] 11#11: worker cycle<br>2021/07/21 13:36:43 [debug] 11#11: epoll timer: -1<br>2021/07/21 13:36:48 [debug] 8#8: epoll: fd:7 ev:0001 d:00007F9A0DDCB548<br>2021/07/21 13:36:48 [debug] 8#8: timer delta: 5334<br>2021/07/21 13:36:48 [debug] 8#8: worker cycle<br>2021/07/21 13:36:48 [debug] 8#8: epoll timer: 60000<br>2021/07/21 13:36:48 [debug] 8#8: epoll: fd:14 ev:0001 d:00007F9A0DDCB718<br>2021/07/21 13:36:48 [debug] 8#8: timer delta: 9<br>2021/07/21 13:36:48 [debug] 8#8: worker cycle<br>2021/07/21 13:36:48 [debug] 8#8: epoll timer: 59991<br>2021/07/21 13:36:48 [debug] 8#8: epoll: fd:14 ev:0001 d:00007F9A0DDCB718<br>2021/07/21 13:36:48 [debug] 8#8: timer delta: 3<br>2021/07/21 13:36:48 [debug] 8#8: worker cycle<br>2021/07/21 13:36:48 [debug] 8#8: epoll timer: 59988<br>2021/07/21 13:36:48 [debug] 8#8: epoll: fd:14 ev:0001 d:00007F9A0DDCB718<br>2021/07/21 13:36:48 [debug] 8#8: shmtx lock<br>2021/07/21 13:36:48 [debug] 8#8: slab alloc: 191 slot: 5<br>2021/07/21 13:36:48 [debug] 8#8: slab alloc: 00007F9A0DE18000<br>2021/07/21 13:36:48 [debug] 8#8: slab alloc: 128 slot: 4<br>2021/07/21 13:36:48 [debug] 8#8: slab alloc: 00007F9A0DE16080<br>2021/07/21 13:36:48 [debug] 8#8: shmtx unlock<br>2021/07/21 13:36:48 [debug] 8#8: shmtx lock<br>2021/07/21 13:36:48 [debug] 8#8: slab alloc: 191 slot: 5<br>2021/07/21 13:36:48 [debug] 8#8: slab alloc: 00007F9A0DE18100<br>2021/07/21 13:36:48 [debug] 8#8: slab alloc: 128 slot: 4<br>2021/07/21 13:36:48 [debug] 8#8: slab alloc: 00007F9A0DE16100<br>2021/07/21 13:36:48 [debug] 8#8: shmtx unlock<br>2021/07/21 13:36:48 [debug] 8#8: malloc: 00007F9A0DD4A5D0:262144<br>2021/07/21 13:36:48 [debug] 8#8: timer delta: 6<br>2021/07/21 13:36:48 [debug] 8#8: worker cycle<br>2021/07/21 13:36:48 [debug] 8#8: epoll timer: 120000<br>2021/07/21 13:36:48 [debug] 8#8: epoll: fd:15 ev:0004 d:00007F9A0DDCB800<br>2021/07/21 13:36:48 [debug] 8#8: timer delta: 1<br>2021/07/21 13:36:48 [debug] 8#8: worker cycle<br>2021/07/21 13:36:48 [debug] 8#8: epoll timer: 120000<br>2021/07/21 13:36:48 [debug] 8#8: epoll: fd:14 ev:0001 d:00007F9A0DDCB718<br>2021/07/21 13:36:48 [debug] 8#8: timer delta: 0<br>2021/07/21 13:36:48 [debug] 8#8: worker cycle<br>2021/07/21 13:36:48 [debug] 8#8: epoll timer: 120000<br>2021/07/21 13:36:49 [debug] 8#8: epoll: fd:15 ev:0005 d:00007F9A0DDCB800<br>2021/07/21 13:36:49 [debug] 8#8: timer delta: 1<br>2021/07/21 13:36:49 [debug] 8#8: worker cycle<br>2021/07/21 13:36:49 [debug] 8#8: epoll timer: 119999<br>2021/07/21 13:37:04 [debug] 8#8: epoll: fd:14 ev:2001 d:00007F9A0DDCB718<br>10.197.96.163 - - [21/Jul/2021:13:37:04 +0000] "GET /1-ws HTTP/2.0" 101 backend:<a href="http://10.197.93.8:80">10.197.93.8:80</a> ssl:TLSv1.3/TLS_AES_256_GCM_SHA384 0 "-" "curl/7.61.1" "-"<br>2021/07/21 13:37:04 [debug] 8#8: timer delta: 15332<br>2021/07/21 13:37:04 [debug] 8#8: worker cycle<br><div>2021/07/21 13:37:04 [debug] 8#8: epoll timer: -1"</div><div><br></div><div>2. It didn't work (The config is using the $http_upgrade variable which seems to be empty)</div><div><br></div><div>"2021/07/21 13:39:40 [debug] 1#1: bind() <a href="http://0.0.0.0:8060">0.0.0.0:8060</a> #6</div>2021/07/21 13:39:40 [debug] 1#1: bind() <a href="http://0.0.0.0:8063">0.0.0.0:8063</a> #7<br>2021/07/21 13:39:40 [notice] 1#1: using the "epoll" event method<br>2021/07/21 13:39:40 [debug] 1#1: counter: 00007F6F213C3080, 1<br>2021/07/21 13:39:40 [notice] 1#1: nginx/1.18.0<br>2021/07/21 13:39:40 [notice] 1#1: OS: Linux 4.14.239-1626564138<br>2021/07/21 13:39:40 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576<br>2021/07/21 13:39:40 [debug] 1#1: write: 8, 00007FFEBDADD2C2, 2, 0<br>2021/07/21 13:39:40 [debug] 1#1: setproctitle: "nginx: master process nginx-debug -c /usr/local/nginx/conf/nginx.conf -g daemon off;"<br>2021/07/21 13:39:40 [notice] 1#1: start worker processes<br>2021/07/21 13:39:40 [debug] 1#1: channel 3:8<br>2021/07/21 13:39:40 [notice] 1#1: start worker process 7<br>2021/07/21 13:39:40 [debug] 1#1: channel 9:10<br>2021/07/21 13:39:40 [debug] 7#7: add cleanup: 00007F6F213C8148<br>2021/07/21 13:39:40 [debug] 7#7: malloc: 00007F6F21455090:8<br>2021/07/21 13:39:40 [notice] 1#1: start worker process 8<br>2021/07/21 13:39:40 [debug] 1#1: pass channel s:1 pid:8 fd:9 to s:0 pid:7 fd:3<br>2021/07/21 13:39:40 [debug] 1#1: channel 11:12<br>2021/07/21 13:39:40 [debug] 8#8: add cleanup: 00007F6F213C8148<br>2021/07/21 13:39:40 [debug] 8#8: malloc: 00007F6F21455090:8<br>2021/07/21 13:39:40 [notice] 1#1: start worker process 9<br>2021/07/21 13:39:40 [debug] 1#1: pass channel s:2 pid:9 fd:11 to s:0 pid:7 fd:3<br>2021/07/21 13:39:40 [debug] 1#1: pass channel s:2 pid:9 fd:11 to s:1 pid:8 fd:9<br>2021/07/21 13:39:40 [debug] 1#1: channel 13:14<br>2021/07/21 13:39:40 [debug] 7#7: notify eventfd: 10<br>2021/07/21 13:39:40 [debug] 9#9: add cleanup: 00007F6F213C8148<br>2021/07/21 13:39:40 [debug] 7#7: eventfd: 11<br>2021/07/21 13:39:40 [debug] 9#9: malloc: 00007F6F21455090:8<br>2021/07/21 13:39:40 [notice] 1#1: start worker process 10<br>2021/07/21 13:39:40 [debug] 7#7: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:39:40 [debug] 1#1: pass channel s:3 pid:10 fd:13 to s:0 pid:7 fd:3<br>2021/07/21 13:39:40 [debug] 8#8: notify eventfd: 12<br>2021/07/21 13:39:40 [debug] 1#1: pass channel s:3 pid:10 fd:13 to s:1 pid:8 fd:9<br>2021/07/21 13:39:40 [debug] 1#1: pass channel s:3 pid:10 fd:13 to s:2 pid:9 fd:11<br>2021/07/21 13:39:40 [debug] 7#7: malloc: 00007F6F21444450:6144<br>2021/07/21 13:39:40 [debug] 1#1: sigsuspend<br>2021/07/21 13:39:40 [debug] 8#8: eventfd: 13<br>2021/07/21 13:39:40 [debug] 7#7: malloc: 00007F6F20985460:237568<br>2021/07/21 13:39:40 [debug] 7#7: malloc: 00007F6F2096C470:98304<br>2021/07/21 13:39:40 [debug] 9#9: notify eventfd: 14<br>2021/07/21 13:39:40 [debug] 8#8: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:39:40 [debug] 7#7: malloc: 00007F6F20953480:98304<br>2021/07/21 13:39:40 [debug] 9#9: eventfd: 15<br>2021/07/21 13:39:40 [debug] 8#8: malloc: 00007F6F21444450:6144<br>2021/07/21 13:39:40 [debug] 8#8: malloc: 00007F6F20985460:237568<br>2021/07/21 13:39:40 [debug] 8#8: malloc: 00007F6F2096C470:98304<br>2021/07/21 13:39:40 [debug] 9#9: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:39:40 [debug] 9#9: malloc: 00007F6F21444450:6144<br>2021/07/21 13:39:40 [debug] 9#9: malloc: 00007F6F20985460:237568<br>2021/07/21 13:39:40 [debug] 9#9: malloc: 00007F6F2096C470:98304<br>2021/07/21 13:39:40 [debug] 8#8: malloc: 00007F6F20953480:98304<br>2021/07/21 13:39:40 [debug] 9#9: malloc: 00007F6F20953480:98304<br>2021/07/21 13:39:40 [debug] 7#7: epoll add event: fd:8 op:1 ev:00002001<br>2021/07/21 13:39:40 [debug] 7#7: setproctitle: "nginx: worker process"<br>2021/07/21 13:39:40 [debug] 7#7: worker cycle<br>2021/07/21 13:39:40 [debug] 7#7: epoll timer: -1<br>2021/07/21 13:39:40 [debug] 7#7: epoll: fd:8 ev:0001 d:00007F6F20985630<br>2021/07/21 13:39:40 [debug] 7#7: channel handler<br>2021/07/21 13:39:40 [debug] 7#7: channel: 32<br>2021/07/21 13:39:40 [debug] 7#7: channel command: 1<br>2021/07/21 13:39:40 [debug] 10#10: add cleanup: 00007F6F213C8148<br>2021/07/21 13:39:40 [debug] 7#7: get channel s:1 pid:8 fd:3<br>2021/07/21 13:39:40 [debug] 7#7: channel: 32<br>2021/07/21 13:39:40 [debug] 7#7: channel command: 1<br>2021/07/21 13:39:40 [debug] 10#10: malloc: 00007F6F21455090:8<br>2021/07/21 13:39:40 [debug] 7#7: get channel s:2 pid:9 fd:12<br>2021/07/21 13:39:40 [debug] 7#7: channel: 32<br>2021/07/21 13:39:40 [debug] 7#7: channel command: 1<br>2021/07/21 13:39:40 [debug] 7#7: get channel s:3 pid:10 fd:13<br>2021/07/21 13:39:40 [debug] 7#7: channel: -2<br>2021/07/21 13:39:40 [debug] 7#7: timer delta: 21<br>2021/07/21 13:39:40 [debug] 7#7: worker cycle<br>2021/07/21 13:39:40 [debug] 7#7: epoll timer: -1<br>2021/07/21 13:39:40 [debug] 9#9: epoll add event: fd:12 op:1 ev:00002001<br>2021/07/21 13:39:40 [debug] 8#8: epoll add event: fd:10 op:1 ev:00002001<br>2021/07/21 13:39:40 [debug] 9#9: setproctitle: "nginx: worker process"<br>2021/07/21 13:39:40 [debug] 8#8: setproctitle: "nginx: worker process"<br>2021/07/21 13:39:40 [debug] 9#9: worker cycle<br>2021/07/21 13:39:40 [debug] 8#8: worker cycle<br>2021/07/21 13:39:40 [debug] 9#9: epoll timer: -1<br>2021/07/21 13:39:40 [debug] 8#8: epoll timer: -1<br>2021/07/21 13:39:40 [debug] 9#9: epoll: fd:12 ev:0001 d:00007F6F20985630<br>2021/07/21 13:39:40 [debug] 8#8: epoll: fd:10 ev:0001 d:00007F6F20985630<br>2021/07/21 13:39:40 [debug] 9#9: channel handler<br>2021/07/21 13:39:40 [debug] 8#8: channel handler<br>2021/07/21 13:39:40 [debug] 10#10: notify eventfd: 16<br>2021/07/21 13:39:40 [debug] 9#9: channel: 32<br>2021/07/21 13:39:40 [debug] 8#8: channel: 32<br>2021/07/21 13:39:40 [debug] 9#9: channel command: 1<br>2021/07/21 13:39:40 [debug] 8#8: channel command: 1<br>2021/07/21 13:39:40 [debug] 9#9: get channel s:3 pid:10 fd:8<br>2021/07/21 13:39:40 [debug] 10#10: eventfd: 17<br>2021/07/21 13:39:40 [debug] 8#8: get channel s:2 pid:9 fd:8<br>2021/07/21 13:39:40 [debug] 9#9: channel: -2<br>2021/07/21 13:39:40 [debug] 8#8: channel: 32<br>2021/07/21 13:39:40 [debug] 9#9: timer delta: 21<br>2021/07/21 13:39:40 [debug] 8#8: channel command: 1<br>2021/07/21 13:39:40 [debug] 9#9: worker cycle<br>2021/07/21 13:39:40 [debug] 8#8: get channel s:3 pid:10 fd:9<br>2021/07/21 13:39:40 [debug] 9#9: epoll timer: -1<br>2021/07/21 13:39:40 [debug] 8#8: channel: -2<br>2021/07/21 13:39:40 [debug] 8#8: timer delta: 21<br>2021/07/21 13:39:40 [debug] 10#10: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:39:40 [debug] 8#8: worker cycle<br>2021/07/21 13:39:40 [debug] 8#8: epoll timer: -1<br>2021/07/21 13:39:40 [debug] 10#10: malloc: 00007F6F21444450:6144<br>2021/07/21 13:39:40 [debug] 10#10: malloc: 00007F6F20985460:237568<br>2021/07/21 13:39:40 [debug] 10#10: malloc: 00007F6F2096C470:98304<br>2021/07/21 13:39:40 [debug] 10#10: malloc: 00007F6F20953480:98304<br>2021/07/21 13:39:40 [debug] 10#10: epoll add event: fd:14 op:1 ev:00002001<br>2021/07/21 13:39:40 [debug] 10#10: setproctitle: "nginx: worker process"<br>2021/07/21 13:39:40 [debug] 10#10: worker cycle<br>2021/07/21 13:39:40 [debug] 10#10: epoll timer: -1<br>2021/07/21 13:39:46 [debug] 7#7: epoll: fd:7 ev:0001 d:00007F6F20985548<br>2021/07/21 13:39:46 [debug] 7#7: timer delta: 5569<br>2021/07/21 13:39:46 [debug] 7#7: worker cycle<br>2021/07/21 13:39:46 [debug] 7#7: epoll timer: 60000<br>2021/07/21 13:39:46 [debug] 7#7: epoll: fd:14 ev:0001 d:00007F6F20985718<br>2021/07/21 13:39:46 [debug] 7#7: timer delta: 11<br>2021/07/21 13:39:46 [debug] 7#7: worker cycle<br>2021/07/21 13:39:46 [debug] 7#7: epoll timer: 59989<br>2021/07/21 13:39:46 [debug] 7#7: epoll: fd:14 ev:0001 d:00007F6F20985718<br>2021/07/21 13:39:46 [debug] 7#7: timer delta: 2<br>2021/07/21 13:39:46 [debug] 7#7: worker cycle<br>2021/07/21 13:39:46 [debug] 7#7: epoll timer: 59987<br>2021/07/21 13:39:46 [debug] 7#7: epoll: fd:14 ev:0001 d:00007F6F20985718<br>2021/07/21 13:39:46 [debug] 7#7: shmtx lock<br>2021/07/21 13:39:46 [debug] 7#7: slab alloc: 191 slot: 5<br>2021/07/21 13:39:46 [debug] 7#7: slab alloc: 00007F6F209D2000<br>2021/07/21 13:39:46 [debug] 7#7: slab alloc: 128 slot: 4<br>2021/07/21 13:39:46 [debug] 7#7: slab alloc: 00007F6F209D0080<br>2021/07/21 13:39:46 [debug] 7#7: shmtx unlock<br>2021/07/21 13:39:46 [debug] 7#7: shmtx lock<br>2021/07/21 13:39:46 [debug] 7#7: slab alloc: 191 slot: 5<br>2021/07/21 13:39:46 [debug] 7#7: slab alloc: 00007F6F209D2100<br>2021/07/21 13:39:46 [debug] 7#7: slab alloc: 128 slot: 4<br>2021/07/21 13:39:46 [debug] 7#7: slab alloc: 00007F6F209D0100<br>2021/07/21 13:39:46 [debug] 7#7: shmtx unlock<br>2021/07/21 13:39:46 [debug] 7#7: malloc: 00007F6F209045C0:262144<br>2021/07/21 13:39:46 [debug] 7#7: timer delta: 7<br>2021/07/21 13:39:46 [debug] 7#7: worker cycle<br>2021/07/21 13:39:46 [debug] 7#7: epoll timer: 120000<br>2021/07/21 13:39:46 [debug] 7#7: epoll: fd:15 ev:0004 d:00007F6F20985800<br>2021/07/21 13:39:46 [debug] 7#7: epoll: fd:14 ev:0001 d:00007F6F20985718<br>2021/07/21 13:39:46 [debug] 7#7: timer delta: 2<br>2021/07/21 13:39:46 [debug] 7#7: worker cycle<br>2021/07/21 13:39:46 [debug] 7#7: epoll timer: 120000<br>2021/07/21 13:39:46 [debug] 7#7: epoll: fd:15 ev:0005 d:00007F6F20985800<br>10.197.96.163 - - [21/Jul/2021:13:39:46 +0000] "GET /1-ws HTTP/2.0" 502 backend:<a href="http://10.197.93.8:80">10.197.93.8:80</a> ssl:TLSv1.3/TLS_AES_256_GCM_SHA384 150 "-" "curl/7.61.1" "-"<br>2021/07/21 13:39:46 [debug] 7#7: timer delta: 4<br>2021/07/21 13:39:46 [debug] 7#7: posted event 00007F6F2096C590<br>2021/07/21 13:39:46 [debug] 7#7: worker cycle<br>2021/07/21 13:39:46 [debug] 7#7: epoll timer: 180000<br>2021/07/21 13:39:46 [debug] 7#7: epoll: fd:14 ev:0001 d:00007F6F20985718<br>2021/07/21 13:39:46 [debug] 7#7: timer delta: 1<br>2021/07/21 13:39:46 [debug] 7#7: worker cycle<br><div>2021/07/21 13:39:46 [debug] 7#7: epoll timer: -1" </div><div><br></div><div><br></div><div>I have also test case 3, where the $http_upgrade variable is still used in the configuration. Here though, I have used a server { listen 80 } context for the nginx which connects to the upstreams, without doing a redirect to https. This case also worked, $http_upgrade seems to be recognized in this context:</div><div><br></div><div>"2021/07/21 13:41:42 [debug] 1#1: bind() <a href="http://0.0.0.0:8060">0.0.0.0:8060</a> #6</div>2021/07/21 13:41:42 [debug] 1#1: bind() <a href="http://0.0.0.0:8063">0.0.0.0:8063</a> #7<br>2021/07/21 13:41:42 [notice] 1#1: using the "epoll" event method<br>2021/07/21 13:41:42 [debug] 1#1: counter: 00007FE63A134080, 1<br>2021/07/21 13:41:42 [notice] 1#1: nginx/1.18.0<br>2021/07/21 13:41:42 [notice] 1#1: OS: Linux 4.14.239-1626564138<br>2021/07/21 13:41:42 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576<br>2021/07/21 13:41:42 [debug] 1#1: write: 8, 00007FFCC83BBFC2, 2, 0<br>2021/07/21 13:41:42 [debug] 1#1: setproctitle: "nginx: master process nginx-debug -c /usr/local/nginx/conf/nginx.conf -g daemon off;"<br>2021/07/21 13:41:42 [notice] 1#1: start worker processes<br>2021/07/21 13:41:42 [debug] 1#1: channel 3:8<br>2021/07/21 13:41:42 [notice] 1#1: start worker process 8<br>2021/07/21 13:41:42 [debug] 1#1: channel 9:10<br>2021/07/21 13:41:42 [debug] 8#8: add cleanup: 00007FE63A1440A8<br>2021/07/21 13:41:42 [debug] 8#8: malloc: 00007FE63A1C6090:8<br>2021/07/21 13:41:42 [notice] 1#1: start worker process 9<br>2021/07/21 13:41:42 [debug] 1#1: pass channel s:1 pid:9 fd:9 to s:0 pid:8 fd:3<br>2021/07/21 13:41:42 [debug] 1#1: channel 11:12<br>2021/07/21 13:41:42 [debug] 9#9: add cleanup: 00007FE63A1440A8<br>2021/07/21 13:41:42 [debug] 9#9: malloc: 00007FE63A1C6090:8<br>2021/07/21 13:41:42 [notice] 1#1: start worker process 10<br>2021/07/21 13:41:42 [debug] 1#1: pass channel s:2 pid:10 fd:11 to s:0 pid:8 fd:3<br>2021/07/21 13:41:42 [debug] 8#8: notify eventfd: 10<br>2021/07/21 13:41:42 [debug] 8#8: eventfd: 11<br>2021/07/21 13:41:42 [debug] 1#1: pass channel s:2 pid:10 fd:11 to s:1 pid:9 fd:9<br>2021/07/21 13:41:42 [debug] 1#1: channel 13:14<br>2021/07/21 13:41:42 [debug] 10#10: add cleanup: 00007FE63A1440A8<br>2021/07/21 13:41:42 [debug] 10#10: malloc: 00007FE63A1C6090:8<br>2021/07/21 13:41:42 [debug] 9#9: notify eventfd: 12<br>2021/07/21 13:41:42 [debug] 8#8: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:41:42 [debug] 9#9: eventfd: 13<br>2021/07/21 13:41:42 [debug] 8#8: malloc: 00007FE63A1B5460:6144<br>2021/07/21 13:41:42 [notice] 1#1: start worker process 11<br>2021/07/21 13:41:42 [debug] 8#8: malloc: 00007FE6396F6470:237568<br>2021/07/21 13:41:42 [debug] 1#1: pass channel s:3 pid:11 fd:13 to s:0 pid:8 fd:3<br>2021/07/21 13:41:42 [debug] 9#9: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:41:42 [debug] 8#8: malloc: 00007FE6396DD480:98304<br>2021/07/21 13:41:42 [debug] 1#1: pass channel s:3 pid:11 fd:13 to s:1 pid:9 fd:9<br>2021/07/21 13:41:42 [debug] 1#1: pass channel s:3 pid:11 fd:13 to s:2 pid:10 fd:11<br>2021/07/21 13:41:42 [debug] 9#9: malloc: 00007FE63A1B5460:6144<br>2021/07/21 13:41:42 [debug] 1#1: sigsuspend<br>2021/07/21 13:41:42 [debug] 9#9: malloc: 00007FE6396F6470:237568<br>2021/07/21 13:41:42 [debug] 9#9: malloc: 00007FE6396DD480:98304<br>2021/07/21 13:41:42 [debug] 8#8: malloc: 00007FE6396C4490:98304<br>2021/07/21 13:41:42 [debug] 10#10: notify eventfd: 14<br>2021/07/21 13:41:42 [debug] 10#10: eventfd: 15<br>2021/07/21 13:41:42 [debug] 11#11: add cleanup: 00007FE63A1440A8<br>2021/07/21 13:41:42 [debug] 9#9: malloc: 00007FE6396C4490:98304<br>2021/07/21 13:41:42 [debug] 11#11: malloc: 00007FE63A1C6090:8<br>2021/07/21 13:41:42 [debug] 10#10: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:41:42 [debug] 10#10: malloc: 00007FE63A1B5460:6144<br>2021/07/21 13:41:42 [debug] 10#10: malloc: 00007FE6396F6470:237568<br>2021/07/21 13:41:42 [debug] 10#10: malloc: 00007FE6396DD480:98304<br>2021/07/21 13:41:42 [debug] 11#11: notify eventfd: 16<br>2021/07/21 13:41:42 [debug] 10#10: malloc: 00007FE6396C4490:98304<br>2021/07/21 13:41:42 [debug] 11#11: eventfd: 17<br>2021/07/21 13:41:42 [debug] 8#8: epoll add event: fd:8 op:1 ev:00002001<br>2021/07/21 13:41:42 [debug] 8#8: setproctitle: "nginx: worker process"<br>2021/07/21 13:41:42 [debug] 9#9: epoll add event: fd:10 op:1 ev:00002001<br>2021/07/21 13:41:42 [debug] 8#8: worker cycle<br>2021/07/21 13:41:42 [debug] 8#8: epoll timer: -1<br>2021/07/21 13:41:42 [debug] 11#11: testing the EPOLLRDHUP flag: success<br>2021/07/21 13:41:42 [debug] 9#9: setproctitle: "nginx: worker process"<br>2021/07/21 13:41:42 [debug] 9#9: worker cycle<br>2021/07/21 13:41:42 [debug] 9#9: epoll timer: -1<br>2021/07/21 13:41:42 [debug] 11#11: malloc: 00007FE63A1B5460:6144<br>2021/07/21 13:41:42 [debug] 8#8: epoll: fd:8 ev:0001 d:00007FE6396F6640<br>2021/07/21 13:41:42 [debug] 8#8: channel handler<br>2021/07/21 13:41:42 [debug] 9#9: epoll: fd:10 ev:0001 d:00007FE6396F6640<br>2021/07/21 13:41:42 [debug] 11#11: malloc: 00007FE6396F6470:237568<br>2021/07/21 13:41:42 [debug] 8#8: channel: 32<br>2021/07/21 13:41:42 [debug] 9#9: channel handler<br>2021/07/21 13:41:42 [debug] 8#8: channel command: 1<br>2021/07/21 13:41:42 [debug] 11#11: malloc: 00007FE6396DD480:98304<br>2021/07/21 13:41:42 [debug] 8#8: get channel s:1 pid:9 fd:3<br>2021/07/21 13:41:42 [debug] 9#9: channel: 32<br>2021/07/21 13:41:42 [debug] 9#9: channel command: 1<br>2021/07/21 13:41:42 [debug] 8#8: channel: 32<br>2021/07/21 13:41:42 [debug] 9#9: get channel s:2 pid:10 fd:8<br>2021/07/21 13:41:42 [debug] 8#8: channel command: 1<br>2021/07/21 13:41:42 [debug] 8#8: get channel s:2 pid:10 fd:12<br>2021/07/21 13:41:42 [debug] 9#9: channel: 32<br>2021/07/21 13:41:42 [debug] 9#9: channel command: 1<br>2021/07/21 13:41:42 [debug] 8#8: channel: 32<br>2021/07/21 13:41:42 [debug] 9#9: get channel s:3 pid:11 fd:9<br>2021/07/21 13:41:42 [debug] 8#8: channel command: 1<br>2021/07/21 13:41:42 [debug] 9#9: channel: -2<br>2021/07/21 13:41:42 [debug] 8#8: get channel s:3 pid:11 fd:13<br>2021/07/21 13:41:42 [debug] 9#9: timer delta: 21<br>2021/07/21 13:41:42 [debug] 9#9: worker cycle<br>2021/07/21 13:41:42 [debug] 8#8: channel: -2<br>2021/07/21 13:41:42 [debug] 11#11: malloc: 00007FE6396C4490:98304<br>2021/07/21 13:41:42 [debug] 9#9: epoll timer: -1<br>2021/07/21 13:41:42 [debug] 8#8: timer delta: 21<br>2021/07/21 13:41:42 [debug] 8#8: worker cycle<br>2021/07/21 13:41:42 [debug] 8#8: epoll timer: -1<br>2021/07/21 13:41:42 [debug] 10#10: epoll add event: fd:12 op:1 ev:00002001<br>2021/07/21 13:41:42 [debug] 10#10: setproctitle: "nginx: worker process"<br>2021/07/21 13:41:42 [debug] 10#10: worker cycle<br>2021/07/21 13:41:42 [debug] 10#10: epoll timer: -1<br>2021/07/21 13:41:42 [debug] 10#10: epoll: fd:12 ev:0001 d:00007FE6396F6640<br>2021/07/21 13:41:42 [debug] 10#10: channel handler<br>2021/07/21 13:41:42 [debug] 10#10: channel: 32<br>2021/07/21 13:41:42 [debug] 10#10: channel command: 1<br>2021/07/21 13:41:42 [debug] 10#10: get channel s:3 pid:11 fd:8<br>2021/07/21 13:41:42 [debug] 10#10: channel: -2<br>2021/07/21 13:41:42 [debug] 10#10: timer delta: 21<br>2021/07/21 13:41:42 [debug] 10#10: worker cycle<br>2021/07/21 13:41:42 [debug] 10#10: epoll timer: -1<br>2021/07/21 13:41:42 [debug] 11#11: epoll add event: fd:14 op:1 ev:00002001<br>2021/07/21 13:41:42 [debug] 11#11: setproctitle: "nginx: worker process"<br>2021/07/21 13:41:42 [debug] 11#11: worker cycle<br>2021/07/21 13:41:42 [debug] 11#11: epoll timer: -1<br>2021/07/21 13:41:48 [debug] 8#8: epoll: fd:6 ev:0001 d:00007FE6396F6470<br>2021/07/21 13:41:48 [debug] 8#8: timer delta: 6547<br>2021/07/21 13:41:48 [debug] 8#8: worker cycle<br>2021/07/21 13:41:48 [debug] 8#8: epoll timer: 60000<br>2021/07/21 13:41:48 [debug] 8#8: epoll: fd:14 ev:0001 d:00007FE6396F6728<br>2021/07/21 13:41:48 [debug] 8#8: timer delta: 0<br>2021/07/21 13:41:48 [debug] 8#8: worker cycle<br>2021/07/21 13:41:48 [debug] 8#8: epoll timer: 120000<br>2021/07/21 13:41:48 [debug] 8#8: epoll: fd:14 ev:0004 d:00007FE6396F6728<br>2021/07/21 13:41:48 [debug] 8#8: timer delta: 0<br>2021/07/21 13:41:48 [debug] 8#8: worker cycle<br>2021/07/21 13:41:48 [debug] 8#8: epoll timer: 120000<br>2021/07/21 13:41:48 [debug] 8#8: epoll: fd:15 ev:0004 d:00007FE6396F6810<br>2021/07/21 13:41:48 [debug] 8#8: timer delta: 1<br>2021/07/21 13:41:48 [debug] 8#8: worker cycle<br>2021/07/21 13:41:48 [debug] 8#8: epoll timer: 120000<br>2021/07/21 13:41:48 [debug] 8#8: epoll: fd:15 ev:0005 d:00007FE6396F6810<br>2021/07/21 13:41:48 [debug] 8#8: timer delta: 1<br>2021/07/21 13:41:48 [debug] 8#8: worker cycle<br>2021/07/21 13:41:48 [debug] 8#8: epoll timer: 119999<br>2021/07/21 13:41:48 [debug] 8#8: epoll: fd:15 ev:0005 d:00007FE6396F6810<br>2021/07/21 13:41:48 [debug] 8#8: timer delta: 0<br>2021/07/21 13:41:48 [debug] 8#8: worker cycle<br>2021/07/21 13:41:48 [debug] 8#8: epoll timer: 119999<br>2021/07/21 13:41:51 [debug] 8#8: epoll: fd:14 ev:2005 d:00007FE6396F6728<br>10.197.96.163 - - [21/Jul/2021:13:41:51 +0000] "GET /1-ws HTTP/1.1" 101 backend:<a href="http://10.197.93.8:80">10.197.93.8:80</a> ssl:-/- 12 "-" "curl/7.61.1" "-"<br>2021/07/21 13:41:51 [debug] 8#8: timer delta: 2870<br>2021/07/21 13:41:51 [debug] 8#8: worker cycle<br>2021/07/21 13:41:51 [debug] 8#8: epoll timer: -1"<div><br></div><div><br></div><div>Judging by the fact that this 3rd test case worked, it seems that the $http_upgrade is there when not doing the ssl termination on the nginx reverse proxy. I don't know though about nginx internals, why this is.</div><div><br></div><div>Best,</div><div>Dorin</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mi., 21. Juli 2021 um 12:48 Uhr schrieb Sergey A. Osokin <<a href="mailto:osa@freebsd.org.ru">osa@freebsd.org.ru</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Dorin,<br>
<br>
hope you're doing well.<br>
<br>
On Tue, Jul 20, 2021 at 12:39:51PM +0200, Dorin RuV wrote:<br>
> Hi everybody,<br>
> <br>
> I'm currently having an issue with nginx which I cannot get to the bottom<br>
> of.<br>
> <br>
> I'm using nginx as a reverse proxy/load balancer in front of Kubernetes.<br>
> I'm trying to set up Websocket connections with an app running in<br>
> Kubernetes, but there are some problems. I have followed the "more<br>
> sophisticated" example from <a href="https://nginx.org/en/docs/http/websocket.html" rel="noreferrer" target="_blank">https://nginx.org/en/docs/http/websocket.html</a>.<br>
> <br>
> The configuration more or less looks like:<br>
> <br>
> "http {<br>
> <br>
> map $http_upgrade $connection_upgrade {<br>
> default upgrade;<br>
> '' close;<br>
> } # building the connection_upgrade variable based on $http_upgrade<br>
> ......<br>
> <br>
> <br>
> server{<br>
> listen 443 ssl http2;<br>
> location / {<br>
> proxy_http_version 1.1;<br>
> proxy_set_header Upgrade $http_upgrade;<br>
> proxy_set_header Connection $connection_upgrade;<br>
> }<br>
> ....<br>
> "<br>
> There is also a server { listen 80 } directive there which simply redirects<br>
> to https.<br>
> <br>
> If I configure "proxy_set_header Upgrade Websocket" and "Connection<br>
> Upgrade", everything works as intended. It seems though that the<br>
> $http_upgrade variable is seen as empty, even though tcpdump confirms the<br>
> fact that the Upgrade header is correctly sent to Nginx by the client<br>
> request. Can somebody please point me towards what could reset this<br>
> variable or why is it unavailable? I'm thinking some scope issues but I<br>
> have no idea how to debug.<br>
<br>
Is there a chance to use debug log feature,<br>
<a href="https://nginx.org/en/docs/debugging_log.html" rel="noreferrer" target="_blank">https://nginx.org/en/docs/debugging_log.html</a>,<br>
and reproduce the issue with "working" and "non-working" configuration<br>
files.<br>
<br>
-- <br>
Sergey Osokin<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div>