-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Extensions fail to load when using reverse proxy with subpath. #7006
-
Hello everyone,
I am deploying a code-server instance with Nginx as a reverse proxy. The two are bundled in one docker container. The plan is to serve code-server under /coder/
subpath, and other services under their unique paths. The editor works fine. I can access the interactive terminal, open every panel, and install extensions from the marketplace. It is just that the extensions are not working.
Here are the details: The code-server and nginx reside in the same container. The code-server is launched with code-server --bind-addr 0.0.0.0:3000 --auth none --cert false
and listens at port 3000. The nginx daemon listens at port 80. Its configuration
looks like:
location ~ ^/coder/(.*)$ { proxy_pass http://127.0.0.1:3000/1ドル; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_read_timeout 300; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto; add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always; client_max_body_size 0; }
The docker container is launched with docker run --rm -p 3000:3000 -p 8000:80 coderwithnginx:latest
, exposing both port 3000 and port 80. When accessing via http://127.0.0.1:3000
, the extensions work. However when accessing via http://127.0.0.1:8000/coder/
, only the editor and terminal work. It looks like the extensions are installed but not activated, and I am getting error messages in the dev console.
截屏2024年09月20日 13 10 04 > Screenshot for the failed scenario 截屏2024年09月20日 13 10 37Screenshot for the working scenario
What could be the possible causes?
Beta Was this translation helpful? Give feedback.
All reactions
Do the query parameters get included in the location match? Wonder if you need proxy_pass http://127.0.0.1:3000/1ドル$is_args$args;
.
Or this should also work, I think:
location /coder/ {
proxy_pass http://127.0.0.1:3000/;
}
Replies: 1 comment 1 reply
-
Do the query parameters get included in the location match? Wonder if you need proxy_pass http://127.0.0.1:3000/1ドル$is_args$args;
.
Or this should also work, I think:
location /coder/ {
proxy_pass http://127.0.0.1:3000/;
}
Beta Was this translation helpful? Give feedback.
All reactions
-
Do the query parameters get included in the location match? Wonder if you need proxy_pass http://127.0.0.1:3000/1ドル$is_args$args;.
This solution works! Thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 1