Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example of how to run code-server with nginx and docker compose #7039

Open
j4ys0n opened this issue Oct 17, 2024 · 8 comments
Open

example of how to run code-server with nginx and docker compose #7039

j4ys0n opened this issue Oct 17, 2024 · 8 comments
Labels
docs Documentation related

Comments

@j4ys0n
Copy link

j4ys0n commented Oct 17, 2024

What is your suggestion?

it would be great to see an example of how to get code-server to work with docker containers using docker compose and nginx/certbot for reverse proxy and tls.

How will this improve the docs?

would make it easy to get this running. i use this pattern all over the place and it simply doesn't work with code-server when there's a password enabled. the redirect after entering the password just doesn't work. i follow the docs, or how i interpret what is meant, and it won't work.

Are you interested in submitting a PR for this?

if i could get it to work..

@j4ys0n j4ys0n added the docs Documentation related label Oct 17, 2024
@code-asher
Copy link
Member

Our docs should work in a container as well. We could maintain compose files for NGINX but I am not sure we want to be prescriptive on what reverse proxies folks should be using. What have you tried and what specific error or behavior are you seeing?

@j4ys0n
Copy link
Author

j4ys0n commented Oct 19, 2024

thanks for your response.

code server does work in a container, don't get me wrong - what i can't seem to get to work is the redirect after entering the password. it just reloads the login page.

i've tried the linuxserver/code-server image and installing code server with the script mentioned in the readme in this repo. i've also tried nginx in a container on a separate server (i use this same nginx server for other reverse proxies on my network) and i've tried nginx in a container on the same server as code server, everything ends in the same result - it won't redirect to the workspace after entering the password. it seems like maybe i'm missing a rule or header or something in the nginx revers proxy config, but i've looked at the request/response headers with and without the proxy and i'm not seeing what that is.

my goal is to have a few of these code server instances that i can use for different things/projects/people and handle the redirects to each via subdomains. i guess i could just implement auth in another layer and remove the password from code server. code server does work as expected without the password.

@j4ys0n
Copy link
Author

j4ys0n commented Oct 23, 2024

@code-asher have you had a chance to look into this? i'd really like to get this working.

@code-asher
Copy link
Member

I was offline last week so I have not looked into it yet. Could you share your NGINX config?

@code-asher
Copy link
Member

It does sort of sound like the cookie somehow is dropped so code-server thinks you are not logged in but I am not sure how that would happen. Happy to poke around if you can provide a way for me to reproduce.

@zhangsan6663
Copy link

omg!!!I encountered the same issue, where I couldn't access the workspace after entering my password. Initially, I deployed using the NAT server I purchased (which has no public IP, and the vendor set up DDNS), but Jupyter Notebook couldn't display code blocks properly due to the lack of an SSL certificate (it displayed correctly when tested via VNC on the server). So, I used Alibaba Cloud's CDN service, pointing another domain to the original URL with a CNAME record. However, at this point, after entering my password, I still couldn't access the workspace and was stuck on a reloading login page. My issue might be too niche to warrant a solution, but I'm still trying to find a way to resolve it.

@zhangsan6663
Copy link

The SSL certificate has been successfully deployed, and I can access it via HTTPS, but I'm still stuck on the login page.

@code-asher
Copy link
Member

Strange, so you submit the password and if you check the network requests, is it making a redirect to the root and then back to the login page? It is not redirecting to the original URL or anything wonky like that?

Similar to above, the first thing that comes to mind is that somehow the code-server-session cookie is not being sent all the way to code-server, but I am not sure how that would happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related
Projects
None yet
Development

No branches or pull requests

3 participants