Black Screen When Using Nginx
See original GitHub issuecode-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
- Use binary installation of code server.
- Create blank
/home/[user]/.code-server/Backups/workspaces.json
file - Run
code-server -p <some port> -d .code-server/
- Log in
- You should see a blank grey screen and an error should be printed to the console.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
I fixed the issue with the following thread: https://github.com/websockets/ws/issues/979
In Nginx, you need to set the following headers:
Not getting this any more on CentOS 7 behind
jwilder/nginx-proxy
.