Skip to content

Commit ce326b0

Browse files
committed
Deal with dual-stack enabling the upstream server liveness check behavior
Since `localhost` resolves to IPv4 as well as IPv6, it causes nginx to enable the upstream server rotation. ``` 2025/02/22 15:14:06 [error] 21#21: *1 no live upstreams while connecting to upstream, client: 192.168.127.1, server: ${base_url}, request: "GET /codeserver/?folder=/opt/app-root/src HTTP/1.1", upstream: "http://localhost/?folder=/opt/app-root/src", host: "localhost:8888" ```
1 parent 6055d5d commit ce326b0

File tree

6 files changed

+23
-4
lines changed

6 files changed

+23
-4
lines changed

codeserver/ubi9-python-3.11/nginx/httpconf/http.conf

+9
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ map $http_x_forwarded_proto $custom_scheme {
3737
default $scheme;
3838
https https;
3939
}
40+
41+
###############
42+
# Dual-stack causes nginx to enable the "If a domain name resolves to several addresses, all of them will be used in a round-robin fashion." behavior
43+
# https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream_tries
44+
###############
45+
upstream workbench_server {
46+
server localhost:8787 max_fails=0;
47+
}
48+
###############

codeserver/ubi9-python-3.11/nginx/serverconf/proxy.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ location = /codeserver {
4545

4646
location /codeserver/ {
4747
# Standard code-server/NGINX configuration
48-
proxy_pass http://localhost:8787/;
48+
proxy_pass http://workbench_server/;
4949
proxy_http_version 1.1;
5050
proxy_set_header Upgrade $http_upgrade;
5151
proxy_set_header Connection $connection_upgrade;

codeserver/ubi9-python-3.11/nginx/serverconf/proxy.conf.template_nbprefix

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ location = / {
5959
location /codeserver/ {
6060
rewrite ^/codeserver/(.*)$ /$1 break;
6161
# Standard RStudio/NGINX configuration
62-
proxy_pass http://localhost:8787;
62+
proxy_pass http://workbench_server/;
6363
proxy_http_version 1.1;
64+
6465
proxy_set_header Upgrade $http_upgrade;
6566
proxy_set_header Connection $connection_upgrade;
6667
proxy_read_timeout 20d;

rstudio/c9s-python-3.11/nginx/httpconf/http.conf

+9
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ map $http_x_forwarded_proto $custom_scheme {
3737
default $scheme;
3838
https https;
3939
}
40+
41+
###############
42+
# Dual-stack causes nginx to enable the "If a domain name resolves to several addresses, all of them will be used in a round-robin fashion." behavior
43+
# https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream_tries
44+
###############
45+
upstream workbench_server {
46+
server localhost:8787 max_fails=0;
47+
}
48+
###############

rstudio/c9s-python-3.11/nginx/serverconf/proxy.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ location = /rstudio {
5050
location /rstudio/ {
5151
rewrite ^/rstudio/(.*)$ /$1 break;
5252
# Standard RStudio/NGINX configuration
53-
proxy_pass http://localhost:8787;
53+
proxy_pass http://workbench_server/;
5454
proxy_http_version 1.1;
5555
proxy_set_header Upgrade $http_upgrade;
5656
proxy_set_header Connection $connection_upgrade;

rstudio/c9s-python-3.11/nginx/serverconf/proxy.conf.template_nbprefix

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ location = / {
7777
location /rstudio/ {
7878
rewrite ^/rstudio/(.*)$ /$1 break;
7979
# Standard RStudio/NGINX configuration
80-
proxy_pass http://localhost:8787;
80+
proxy_pass http://workbench_server/;
8181
proxy_http_version 1.1;
8282
proxy_set_header Upgrade $http_upgrade;
8383
proxy_set_header Connection $connection_upgrade;

0 commit comments

Comments
 (0)