code-server version: code-server1.1156-vsc1.33.1-linux-x64.tar.gzcode-server works fine with Nginx with location set as "location /". However, when location is set to "location /vscode/" code-server fails to properly redirect to the password entry page. It redirects me to <IPv4 Public IP>/login/ which contains 404 Not Found nginx/1.14.0 (Ubuntu). Location "location /vscode/" works fine when code-server -N flag is included. Is there additional arguments I can give Nginx that can help it redirect?
SSH into EC2 instance
Install Nginx and set configuration as follows
# Server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location /vscode/ {
proxy_pass http://localhost:1500/;
rewrite ^/vscode/(.)$ /$1 break;
proxy_set_header Host $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 $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_redirect http://localhost:1500 https://<IPv4 Public IP>;
}
}
Download code-server stable and run
./server/code-server -p 1500 -H
Go to web address
<IPv4 Public IP>/vscode/
example
12.345.67.891/vscode/
We're already fixing this on #857. If you want to please help us test the upcoming changes.
I would love to... How do I do that?
I made some LKGR Builds which should allow you to test daily builds of the web branch. Check that out if you don't want to build from source.
Duplicate of #241.
It appears this login redirect is still an issue on the current release [1.1156-vsc1.33.1] but have found a _workaround_ when using NGINX and the following _proxy_redirect_ configurations in a location, eg:
location /vscode/ {
proxy_pass https://localhost:8443/;
rewrite ^/vscode/(.)$ /$1 break;
proxy_redirect https://localhost:8443/ https://code.example.com/vscode/;
proxy_redirect ~^/(.*)$ https://code.example.com/vscode/$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
The _first directive_ rewrites _localhost_ redirects while the _second directive_ rewrites redirects with _absolute paths_ which catches the redirects to "/login" and then "/login/" correctly for me!
Hope this helps out someone else until the next release!
Are you using code-server v2? I believe this was fixed in v2.
On Thu, Dec 12, 2019 at 12:05 AM projx notifications@github.com wrote:
Looks like this is still occurring. When running nginx under http:///cs/
the login always redirects to http:///login. This is occuring using the
template provided in the self-hosted quickstart:
https://github.com/cdr/code-server/blob/master/doc/quickstart.md—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/cdr/code-server/issues/884?email_source=notifications&email_token=ACVYSVD4DOCWBEC6AOTJPYLQYF54ZA5CNFSM4IJEDJK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGU75MA#issuecomment-564788912,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACVYSVFAON4HIYYUAHSHD33QYF54ZANCNFSM4IJEDJKQ
.
Hi all,
Per latest version 2.1698-vsc1.41.1, the below setting works as expected by passing --base-path argument (fixed #241).
Here is the setting hope it is useful for people encountered same issue.
location /vscode/ {
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
proxy_pass http://localhost:8441/;
}
./code-server --port 8441 --auth password --base-path /vscode
Most helpful comment
It appears this login redirect is still an issue on the current release [1.1156-vsc1.33.1] but have found a _workaround_ when using NGINX and the following _proxy_redirect_ configurations in a location, eg:
The _first directive_ rewrites _localhost_ redirects while the _second directive_ rewrites redirects with _absolute paths_ which catches the redirects to "/login" and then "/login/" correctly for me!
Hope this helps out someone else until the next release!