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.

Black Screen When Using Nginx

See original GitHub issue
  • code-server version: 1.32.0
  • OS Version: Ubuntu 18 LTS (aws t2.micro)

Description

I am self hosting code server. When I first tried to run code-server, I ran into this error: https://github.com/codercom/code-server/issues/121. I fixed the error by specifying -d /home/[user]/.code-server and manually creating /home/[user]/.code-server/Backups/workspaces.json as a blank file.

However, while code server allows me to log in, I get a grey screen and the following error prints to the console:

ERROR SHARED stderr {"data":"Uncaught Exception: Error: Unexpected end of JSON input\n\nSyntaxError: Unexpected end of JSON input\n at JSON.parse (<anonymous>)\n at pfs_1.readFile.then.contents (eval at exports.requireModule (/home/ubuntu/code-server-1.32.0-310-linux-x64/code-server:468:27684), <anonymous>:77277:45)\n at <anonymous>\n at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/home/ubuntu/code-server-1.32.0-310-linux-x64/code-server:468:27684), <anonymous>:52540:31)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)\n"}

I am using the following command: code-server --allow-http -p 3001 -d .code-server/ my-project-dir I am using allow-http because I am using nginx as a reverse proxy.

Steps to Reproduce

  1. Use binary installation of code server.
  2. Create blank /home/[user]/.code-server/Backups/workspaces.json file
  3. Run code-server -p <some port> -d .code-server/
  4. Log in
  5. You should see a blank grey screen and an error should be printed to the console.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
vedantroycommented, Mar 25, 2019

I fixed the issue with the following thread: https://github.com/websockets/ws/issues/979

In Nginx, you need to set the following headers:

location / {
    proxy_pass http://foobar:3005/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
}
0reactions
boardfishcommented, Apr 20, 2019

Not getting this any more on CentOS 7 behind jwilder/nginx-proxy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Black Screen When Using Nginx #333 - coder/code-server
I am using allow-http because I am using nginx as a reverse proxy. Steps to Reproduce. Use binary installation of code server. Create...
Read more >
Nginx user change causes blank screen on Chrome and 200 ...
As soon as I switch the user back to nginx and reload, it works fine. What am I missing when switching the user?...
Read more >
My site shows a blank screen and i get GET https://ip-address ...
I was able to deploy my laravel app on ubuntu using nginx ... However, i get a blank screen and this error messages...
Read more >
Bokeh with NGINX reverse proxy gives a Blank White Screen
Hi, I have bee struggling with this problem for a few weeks, the problem is detailed here: Bokeh Sever with NGINX gives Blank...
Read more >
Jellyfin Nginx issues (Suddently stopped working) - Reddit
Go back and check the nginx config file i made, no changed obiously, so copied it to a safe ... but just loads...
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