Skip to content

Access via nginx reverse proxy, 404 not found page shows randomly #773

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

Closed
CXZ7720 opened this issue Jun 14, 2019 · 8 comments
Closed

Access via nginx reverse proxy, 404 not found page shows randomly #773

CXZ7720 opened this issue Jun 14, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@CXZ7720
Copy link

CXZ7720 commented Jun 14, 2019

  • code-server version: via dockerhub latest tag
  • OS Version: Ubuntu Server 18.04.2 LTS

Description

I pulled code-server via docker command in readme.md
docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/code-server --allow-http --no-auth with environment option VIRTUAL_HOST=code.example.net for nginx reverse proxy.

When I access the code page, It opens well at first time. But in case of refresh the page or open new tab both default mode and incognito mode via chrome browser, it serves 404 Not found pages.

In container logs,
Error: ENOENT: no such file or directory, open '/src/packages/server/build/web/index.html'

container_logs

How can I fix it?

@CXZ7720 CXZ7720 added the bug Something isn't working label Jun 14, 2019
@naomi-nori
Copy link

Does your nginx config include headers to allow for websocket upgrade requests? Something like the following:

location / {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";

    proxy_pass http://code:8443/;
}

@deansheather
Copy link
Member

What browser and device are you using to access code-server? We gzip files inside of the code-server binary to make it smaller, so accessing on browsers that don't have gzip support will fail.

If you're using an iPad, try the iPad OS beta.

@thinkallabout
Copy link

Hi, I'm attempting to run this on Google Cloud Shell - ideal for this type of environment.

  • The system requires you to access through an NGINX reverse proxy.
  • The proxy is Google-managed, so I have no way to modify the config. I have the same errors.

Here's the terminal output I've gotten when trying to run the container:

docker run -it -p 0.0.0.0:8443:8443 -v "${PWD}:/home/cameronbrownjames/decoupagedreams.co.uk" codercom/code-server --allow-http --no-auth
(node:6) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
INFO  code-server v1.1156-vsc1.33.1
INFO  Additional documentation: http://github.com/cdr/code-server
INFO  Initializing {"data-dir":"/home/coder/.local/share/code-server","extensions-dir":"/home/coder/.local/share/code-server/extensions","working-dir":"/home/coder/project","log-dir":"/home/coder/.cache/code-server/logs/20190629033125573"}
INFO  Starting shared process [1/5]...
INFO  Starting webserver... {"host":"0.0.0.0","port":8443}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://github.com/cdr/code-server/blob/master/doc/security/ssl.md
WARN  
WARN  Launched without authentication.
INFO  
INFO  Started (click the link below to open):
INFO  http://localhost:8443/
INFO  
WARN  stderr {"data":"(node:19) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
INFO  Connected to shared process
Error: ENOENT: no such file or directory, open '/src/packages/server/build/web/index.html'

Any advice on what I can do? I've attempted setting my VIRTUAL_HOST environment variable which made no difference.

@deansheather
Copy link
Member

What browser are you using? I doubt that google's proxy will strip Accept-Encoding headers.

@CXZ7720
Copy link
Author

CXZ7720 commented Jun 30, 2019

@naomi-nori I'll check about it soon. Thanks.
@deansheather I'm using Chrome/73.0.3683.103 and Windows10 1903 x64.

@thinkallabout
Copy link

@deansheather Tried on Chrome 75.0.3770.100 and Firefox 67.0.4.

@Cloudmersive
Copy link

No resolution on this?

@sr229
Copy link
Contributor

sr229 commented Nov 7, 2019

We already have some fixes in more recent issues so closing this off.

@sr229 sr229 closed this as completed Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants