question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

404 On files through nginx reverse proxy running code-server in a docker container

See original GitHub issue

Hello, I have installed code-server. It worked previously, but it has stopped working. This is what I see in Firefox: image This is my nginx reverse proxy setup:

server {
    listen      199.192.19.234:80;
    server_name coder.diademiemi.me;

    location / {
        rewrite ^ https://$host$request_uri? permanent;
    }
}

server {
        server_name coder.diademiemi.me;
        listen 199.192.19.234:443;
        ssl on;
        ssl_certificate /etc/letsencrypt/live/diademiemi.me-0005/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/diademiemi.me-0005/privkey.pem;

        location / {
        proxy_pass http://172.17.0.2:8080;

        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
        }
}

This is what I use to start code-server:

docker run -d -it --name code-server --restart always --ip 172.17.0.2 -p 8080:8080 --env-file coder.env -v "/srv/coder:/home/coder/host" -v "/home/coder/:/home/coder/" codercom/code-server \
 --disable-telemetry \
docker exec -it code-server sudo /usr/bin/apt -y update
docker exec -it code-server sudo /usr/bin/apt -y update --fix-missing
docker exec -it code-server sudo /usr/bin/apt -y install cmake default-jre python3 python3-pip nodejs zsh git

Is this a bug? How can I fix this? it used to work

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
code-ashercommented, Mar 23, 2020

Ohhh, I think I see what’s going on. code-server makes all requests against the base, so if you need the requests to go against some other path then you’ll need to rewrite the URL.

For nginx I think adding a trailing slash on proxy_pass should do it. For example: proxy_pass http://localhost:8080/;.

1reaction
AlaaElrifaiecommented, May 18, 2020

I have the trailing slash already within my NGINX config file proxy_pass http://127.0.0.1:8080/; But I’m having the same issue with vscode-remote-resource https://dev.mydomain.com/vscode-remote-resource?path=%5Cusr%5Clib%5Ccode-server%5Clib%5Cvscode%5Cextensions%5Ctheme-seti%5Cicons%5Cseti.woff&tkn= CodeServer01

Everything was working fine on version 3.2.0. This is on 3.3.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

404 On files through nginx reverse proxy running code ...
It worked previously, but it has stopped working. This is what I see in Firefox: image. This is my nginx reverse proxy setup:...
Read more >
Simple reverse proxy with nginx and docker gives 404
As Richard noticed http://172.17.0.3/merlin is passed to http://172.17.0.2:5555/merlin which didn't exist, hence the 404.
Read more >
nginx - code-server (docker) and nuxt.js / javascript 404
You can't have HMR running on a hosted production app through some DNS, reverse proxy, port forwarding and so on.
Read more >
Simple reverse proxy in docker with nginx gives 404
0.4) through the reverse-proxy(172.17.0.3). I only want the interactions between the containers, nothing outside them. So far I can get ...
Read more >
Updated Collabora/Nextcloud and now get 404?
I have it installed standalone and proxy to it from my proxy server (nginx). I have it installed using docker, and to upgrade...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found