Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Help - blank page after login : "nginx" on "mac osx" certified with "certbot" #2610

Answered by code-asher
pwangjoo asked this question in Q&A
Discussion options

Hi, I'm currently very new to server and stuff, but found code-server very fascinating.
I'm trying several ways to get things work, and my explanation can be a bit weird, but please bear with me.

Some settings of mine:

  • Web Browser: Chrome
  • Local OS: Windows
  • Remote OS: OS X Catalina
  • Code-Server Version: 3.8.0
  • Nginx Version: 1.19.6

I am currently running code-server on my Macbook.
Installed code-server, nginx, certbot with brew. (not using docker)

I wanted to run code-server under subdomain, and it seemed to work fine until I got a blank white page after log-in.
(It works fine when I access it through http://localhost:8080/ locally on Macbook.)

What I'm doing to start servers:

  1. brew services start code-server
  2. brew services start nginx

Before logging-in:
image

After logging-in:
image

I've found some "possibly" related discussions that this is websocket related issue when you try to access it using iPad (with remote server Ubuntu), but I am on Windows Chrome.

Some logs that might be helpful:
image

code-server config file:

bind-addr: 127.0.0.1:8080
auth: password
password: my_passwd
cert: false

nginx .conf file:

 server {
 server_name code._______.com;
 
 location / {
 proxy_pass http://localhost:8080/;
 proxy_set_header Host $host;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection upgrade;
 proxy_set_header Accept-Encoding gzip;
 }
 
 listen 443 ssl http2;
 ssl_certificate /etc/letsencrypt/live/_______.com/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/_______.com/privkey.pem;
 include /etc/letsencrypt/options-ssl-nginx.conf;
 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
 }
 server {
 if ($host = www._______.com) {
 return 301 https://$host$request_uri;
 }
 
 if ($host = code._______.com) {
 return 301 https://$host$request_uri;
 } 
 if ($host = _______.com) {
 return 301 https://$host$request_uri;
 }
 listen 80;
 listen [::]:80;
 server_name _______.com www._______.com code._______.com;
 return 404;
 }

(注記) I don't think this matters, but I have chmod 755ed /etc/letsencrypt/live/* due to nginx permission error.

What I have tried:

  1. Forwarding without nginx, and accessing with https://_______:8080/
bind-addr: [internal_ip_that_is_forwarded]:8080
auth: password
password: my_passwd
cert: true
  • cons: I cannot set subdomain, and extensions won't work
  1. Forwarding with nginx but without subdomain, and accessing with https://_______/code/
  • cons: still got white blank page after log-in
  1. Forwarding with nginx but without certificates, and accessing with http://code._______.com/
bind-addr: 127.0.0.1:8080
auth: password
password: my_passwd
cert: false
  • cons: extensions won't work

What am I missing?? I'm totally lost...

You must be logged in to vote
I don't think this one is websockets. It seems to have failed to download the main JavaScript bundle (workbench.web.api.js). Since this fails it tries to load files individually but we only ship the bundle with code-server and not individual files. Are you able to open workbench.web.api.js directly in its own tab from the network list? If so, the browser might then cache it and then subsequent loads might work. I'm not sure what causes this though. Maybe the network tab has some information on why it failed? Or possibly the nginx logs themselves might have something to say.

Replies: 2 comments 5 replies

Comment options

Also tried code-server --link to upstream code-server instead of brew service start code-server, gave me error like this:

$ code-server --link
[2021年01月21日T07:34:47.374Z] info code-server 3.8.0 c4610f7829701aadb045d450013b84491c30580d
[2021年01月21日T07:34:47.375Z] info Using user-data-dir ~/.local/share/code-server
[2021年01月21日T07:34:47.395Z] info Using config file ~/.config/code-server/config.yaml
[2021年01月21日T07:34:47.395Z] info HTTP server listening on http://127.0.0.1:50348 (randomized by --link)
[2021年01月21日T07:34:47.396Z] info - Authentication is disabled (disabled by --link)
[2021年01月21日T07:34:47.396Z] info - Not serving HTTPS (disabled by --link)
[2021年01月21日T07:34:49.475Z] info Unfortunately we cannot ensure a good user experience with your connection latency (196ms). Efforts are underway to accommodate users in most areas.
[2021年01月21日T07:34:49.479Z] error coder cloud agent exited with 1
You must be logged in to vote
0 replies
Comment options

I don't think this one is websockets. It seems to have failed to download the main JavaScript bundle (workbench.web.api.js). Since this fails it tries to load files individually but we only ship the bundle with code-server and not individual files. Are you able to open workbench.web.api.js directly in its own tab from the network list? If so, the browser might then cache it and then subsequent loads might work. I'm not sure what causes this though. Maybe the network tab has some information on why it failed? Or possibly the nginx logs themselves might have something to say.
You must be logged in to vote
5 replies
Comment options

Thank you for your kind reply.

The exact console log says
Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR on https://code.________.com/static/c4610f7829701aadb045d450013b84491c30580d/usr/local/Cellar/code-server/3.8.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js

image

When I try your suggestion on opening workbench.web.api.js directly,
I was able to see a tab with texts, but even so, I was still unable to see any contents after reload.

image
(Please tell me if I'm doing this wrong...)

Searched a bit about ERR_HTTP2_PROTOCOL_ERROR on Chrome,
and tried https://www.digitalocean.com/community/questions/chrome-console-error-net-err_http2_protocol_error-200-some-site-s-content-doesn-t-available, but was still unable to load contents.

Comment options

Just checked error log of nginx, and found that it has a permission error.

2021年01月25日 13:22:22 [error] 58539#0: *2 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 203.XXX.117.XX, server: code._________.com, request: "GET / HTTP/2.0", upstream: "http://[::1]:8080/", host: "code._________.com"
2021年01月25日 13:22:23 [crit] 58539#0: *2 open() "/usr/local/var/run/nginx/proxy_temp/1/00/0000000001" failed (13: Permission denied) while reading upstream, client: 203.XXX.117.XX, server: code._________.com, request: "GET /static/c4610f7829701aadb045d450013b84491c30580d/usr/local/Cellar/code-server/3.8.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js HTTP/2.0", upstream: "http://127.0.0.1:8080/static/c4610f7829701aadb045d450013b84491c30580d/usr/local/Cellar/code-server/3.8.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js", host: "code._________.com", referrer: "https://code._________.com/"
2021年01月25日 13:22:23 [crit] 58539#0: *2 open() "/usr/local/var/run/nginx/proxy_temp/2/00/0000000002" failed (13: Permission denied) while reading upstream, client: 203.XXX.117.XX, server: code._________.com, request: "GET /static/c4610f7829701aadb045d450013b84491c30580d/usr/local/Cellar/code-server/3.8.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js HTTP/2.0", upstream: "http://127.0.0.1:8080/static/c4610f7829701aadb045d450013b84491c30580d/usr/local/Cellar/code-server/3.8.0/libexec/lib/vscode/out/vs/workbench/workbench.web.api.js", host: "code._________.com", referrer: "https://code._________.com/"

I think there's a permission problem with my node? or nginx? or my code-server folder? not sure...
But it seems to me that it isn't really related to code-server.

Thank you for your help.

Comment options

Okay, I have run sudo brew restart services --all before when I was testing with nginx settings,
which I think screwed up some permission of nginx folder.
I've done chmod -R 777 /usr/local/var/run/nginx/proxy_temp and finally got it working.

Thank you so much for your kind reply on my dumb question.
Have a nice day!

Comment options

Awesome, I'm glad you figured it out. Happy coding!

Comment options

2024年12月27日 15:01:18 [crit] 3116121#3116121: *14449 mkdir() "/var/lib/nginx/proxy/1/19" failed (30: Read-only file system) while reading upstream, ..., request: "GET /stable-08cbdfbdf11925e8a14ee03de97b942bba7e8a94/static/out/nls.messages.js HTTP/2.0", upstream: "http://127.0.0.1:5000/stable-08cbdfbdf11925e8a14ee03de97b942bba7e8a94/static/out/nls.messages.js", ...

I faced an similar issue a while ago due to some security hardenings,
and the solution for me was to disable proxy buffering instead.

add this inside http block of nginx.conf

proxy_buffering off;
Answer selected by pwangjoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /