Skip to content

Commit cc4a0a4

Browse files
chaturvediknajiridanek
authored andcommitted
RHOAIENG-17306: feat(codeserver): do not ignore IPv6 when it's available
1 parent 63e5207 commit cc4a0a4

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

codeserver/ubi9-python-3.11/nginx/api/kernels/access.cgi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ echo "Status: 200"
33
echo "Content-type: application/json"
44
echo
55
# Query the heartbeat endpoint
6-
HEALTHZ=$(curl -s http://127.0.0.1:8888/codeserver/healthz)
6+
HEALTHZ=$(curl -s http://localhost:8888/codeserver/healthz)
77
# Extract last_activity | remove milliseconds
88
LAST_ACTIVITY_EPOCH=$(echo $HEALTHZ | grep -Po 'lastHeartbeat":\K.*?(?=})' | awk '{ print substr( $0, 1, length($0)-3 ) }')
99
# Convert to ISO8601 date format

codeserver/ubi9-python-3.11/nginx/root/opt/app-root/nginxconf.sed

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Change port
22
/listen/s%80%8888 default_server%
33

4-
# Remove listening on IPv6
5-
/\[::\]/d
6-
74
# One worker only
85
/worker_processes/s%auto%1%
96

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

Lines changed: 1 addition & 1 deletion
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://127.0.0.1:8787/;
48+
proxy_pass http://localhost:8787/;
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ location = / {
5959
location /codeserver/ {
6060
rewrite ^/codeserver/(.*)$ /$1 break;
6161
# Standard RStudio/NGINX configuration
62-
proxy_pass http://127.0.0.1:8787;
62+
proxy_pass http://localhost:8787;
6363
proxy_http_version 1.1;
6464
proxy_set_header Upgrade $http_upgrade;
6565
proxy_set_header Connection $connection_upgrade;

codeserver/ubi9-python-3.11/run-code-server.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,20 @@ if [ ! -d "$logs_dir" ]; then
110110
mkdir -p "$logs_dir"
111111
fi
112112

113+
# IPv6 support
114+
echo "Checking IPv6 support..."
115+
if [ -f /proc/net/if_inet6 ]; then
116+
BIND_ADDR="[::]:8787" # IPv6/dual-stack
117+
echo "IPv6 detected: binding to all interfaces (IPv4 + IPv6)"
118+
else
119+
BIND_ADDR="0.0.0.0:8787" # IPv4 only
120+
echo "IPv6 not detected: falling back to IPv4 only"
121+
fi
122+
113123
# Start server
114124
start_process /usr/bin/code-server \
115-
--bind-addr 0.0.0.0:8787 \
116-
--disable-telemetry \
117-
--auth none \
118-
--disable-update-check \
119-
/opt/app-root/src
125+
--bind-addr "${BIND_ADDR}" \
126+
--disable-telemetry \
127+
--auth none \
128+
--disable-update-check \
129+
/opt/app-root/src

0 commit comments

Comments
 (0)