I am trying to run code server in a docker container behind nginx. I would like the entire code server to run at the /code
path. I tried following the configuration listed on here in the answer provided by demsys since it seems to be my exact situation, but I keep getting 502 Bad Gateway
. My nginx config is
location /code/ {
proxy_pass https://127.0.0.1:8443/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
}
The result of curl -ILv my.domain.com/code
is
> HEAD /code HTTP/1.1
> Host: my.domain.com
> User-Agent: curl/7.82.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
HTTP/1.1 301 Moved Permanently
< Server: nginx/1.18.0 (Ubuntu)
Server: nginx/1.18.0 (Ubuntu)
< Date: Sun, 29 Jan 2023 13:15:38 GMT
Date: Sun, 29 Jan 2023 13:15:38 GMT
< Content-Type: text/html
Content-Type: text/html
< Content-Length: 178
Content-Length: 178
< Location: https://my.domain.com/code/
Location: https://my.domain.com/code/
< Connection: keep-alive
Connection: keep-alive
<
* Connection #0 to host my.domain.com left intact
* Issue another request to this URL: 'https://my.domain.com/code/'
* Found bundle for host my.domain.com: 0x558aa4fc6370 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#0) with host my.domain.com
* Connected to my.domain.com (my.global.ip.addr) port 443 (#0)
> HEAD /code/ HTTP/1.1
> Host: my.domain.com
> User-Agent: curl/7.82.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 502 Bad Gateway
HTTP/1.1 502 Bad Gateway
< Server: nginx/1.18.0 (Ubuntu)
Server: nginx/1.18.0 (Ubuntu)
< Date: Sun, 29 Jan 2023 13:15:38 GMT
Date: Sun, 29 Jan 2023 13:15:38 GMT
< Content-Type: text/html
Content-Type: text/html
< Content-Length: 166
Content-Length: 166
< Connection: keep-alive
Connection: keep-alive
<
* Connection #0 to host my.domain.com left intact
Its really weird as I'm running Emby on the root path and that redirects just fine with just the proxy_pass line. Any help would be appreciated. Thanks!