Nevermind - got it to work. The problem was not Nginx, but my code-server.service. I used 0.0.0.0 as Ip - changed that to 127.0.0.1 and it works...
Now onto getting SSL to work :-)
I've been messing around with this today in an attempt to get a secure connection to my local server.
I've installed code-server as a docker container running on port 8443 and wanted to get rid of the insecure message. I run a Nginx server as a reverse proxy on the same machine.
Here is the appropriate snippet from my Nginx config:
Some of the headers may be redundant but the above works for me.
The thing that finally made this work was the trailing "/" on the location.
got truly inspired by this answer. before seeing it, I thought the only way to reverse-proxy /code-server is by setting the context url for vscode to be /code-server. never thought the trailing slash would solve it! truly thankful!!!
I have similar setup to yourself, code server as Docker container and LetsEncrypt for SSL handing. Code server is working except I'm unable to clone a github repo based on user name / password. I get "Oh no! An error occurred!" / forbidden message when trying to use git extension to obtain github authorisation.
Are you able to sign in to github with your code server / nginx setup?
Addiionally I've tried using a github generated token but that also fails, but with error relating to incorrect format.
Thanks to the hint above, if anyone needs to make Traefik work, here are the two middlewares I'm using on mine. The code-redirect adds the trailing slash, and the code-stripprefix... strips the prefix.
Nevermind - got it to work. The problem was not Nginx, but my code-server.service. I used 0.0.0.0 as Ip - changed that to 127.0.0.1 and it works...
Now onto getting SSL to work :-)
I've been messing around with this today in an attempt to get a secure connection to my local server.
I've installed code-server as a docker container running on port 8443 and wanted to get rid of the insecure message. I run a Nginx server as a reverse proxy on the same machine.
Here is the appropriate snippet from my Nginx config:
location /code-server/ {
proxy_pass
http://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;
}
https://my.domain/code-server/ now works.
Some of the headers may be redundant but the above works for me.
The thing that finally made this work was the trailing
"/"
on the location.got truly inspired by this answer. before seeing it, I thought the only way to reverse-proxy /code-server is by setting the context url for vscode to be /code-server. never thought the trailing slash would solve it! truly thankful!!!
I have similar setup to yourself, code server as Docker container and LetsEncrypt for SSL handing. Code server is working except I'm unable to clone a github repo based on user name / password. I get "Oh no! An error occurred!" / forbidden message when trying to use git extension to obtain github authorisation.
Are you able to sign in to github with your code server / nginx setup?
Addiionally I've tried using a github generated token but that also fails, but with error relating to incorrect format.
Thanks to the hint above, if anyone needs to make Traefik work, here are the two middlewares I'm using on mine. The
code-redirect
adds the trailing slash, and thecode-stripprefix
... strips the prefix.I have been looking for hours, it now works, I was missing those headers:
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
More replies