code-server works locally but failed as a back-end behind apache2 #4089
-
I have a code-server set up similar to that of cleanet #4030 My code-server runs on a local machine with a local ip addr of 192.168.1.123 with a config like this:
It works flawlessly if I access it from a browser on a machine in the local network. Another machine in the local network runs an apache2 server and is exposed to the internet through Cloudflare (A. for https protection and B. my ISP only allows port 80 access to my network.) So Similar to what cleanet has tried, I have added a VirtualHost to apache2 to allow access to the code-server as a back-end server through a sub-domain: The apache VirtualHost section for that is like this:
Of course I have a When I tried to access the code-server with: However, after the successful authentication with the correct password, the page turned blank with the script behind got into some endless activities what consume a lot of CPU cycles (closing the page would immediately brought down CPU usage to normal.) Local access to the code-server through I'm guessing that this is probably caused by some simple reverse proxy setup mistakes/omissions that have messed up the communication between the script loaded into the browser (after authentication) and the apache2 entry point. (I think I've found the crux of the problem now. See Edit at the end.) Many thanks! Nibikibaba PS. I've tried setting code-server to listen on port 80 directly and removed the Edit: I have gone through the errors in the browser and have found that the problem is that it is unable to establish a websocket connection to the code-server machine. This is because apache2 is unable to reverse proxy websocket communications. It seems that the solution would have to be something like the use of something like HAProxy to act as a front-end to apache2 and code-server. Does anyone know if the Cloudflare proxy front would allow websocket communications to go through at all? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Nice debugging! Maybe @code-asher knows? |
Beta Was this translation helpful? Give feedback.
-
I think you are probably just missing the websocket upgrade. This comment may be of help: #2104 (comment) |
Beta Was this translation helpful? Give feedback.
I think you are probably just missing the websocket upgrade. This comment may be of help: #2104 (comment)