- Notifications
You must be signed in to change notification settings - Fork6.1k
Question: Using code-server with nginx and base path appended#1739
-
I expose (old) code-server via nginx, with the base path set. (e.g. expose code-server at |
BetaWas this translation helpful?Give feedback.
All reactions
Yup, the critical part is the trailing slash onproxy_pass
.
location /vs-code/ { proxy_pass http://localhost:8080/;
That's what makes nginx rewrite the URL without the base path.
Replies: 6 comments 1 reply
-
BetaWas this translation helpful?Give feedback.
All reactions
-
@nao20010128nao if code server doesn't have the ability to set base path, you can always setup nginx torewrite requests. |
BetaWas this translation helpful?Give feedback.
All reactions
-
See the Deep Ocean tutorial I put in#1741 |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yup, the critical part is the trailing slash on
That's what makes nginx rewrite the URL without the base path. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 4
-
Makes sense, all our links are relative otherwise so that's why |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
We need a proxy_redirect to rewrite the 302 request returned by code-server to avoid routing to the wrong path. Because code-server will return a 302 response with So the complete configuration should be like this:
Then open |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hmm strange, when you use a trailing slash in Maybe we have a bug in generating that relative path, although I am not sure what it could be. Or maybe NGINX is sending the wrong request path, but that seems less likely. |
BetaWas this translation helpful?Give feedback.
All reactions
This discussion was converted from issue #1739 on August 20, 2020 22:21.