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

Using code-server Reverse Proxy on Apache2 VirtualHost #3667

Answered by jsjoeio
TyroneMorley asked this question in Q&A
Discussion options

I am hosting a site on port 80 on my Ubuntu Apache2 server.
I am using another VirtualHost with ServerName set to app.mydomain.com for a certain area of my site. That VirtualHost uses DocumentRoot.
I have another Apache VirtualHost port 80 site enabled which has a reverse proxy to 192.168.1.200:8080 (which is the address that code-server is listening on). This is the contents of my dev.mydomain.com site:

<VirtualHost *:80>
 RewriteEngine On
 ServerName dev.[mydomain].com
 # Proxy Traffic
 RewriteCond %{HTTP:Upgrade} =websocket
 RewriteRule /(.*) ws://192.168.1.200:8080/1ドル [P,L]
 RewriteCond %{HTTP:Upgrade} !=websocket
 RewriteRule /(.*) http://192.168.1.200:8080/1ドル [P,L]
</VirtualHost>

When I go to dev.mydomain.com, I see code-server login page. However, when I log in, the page hangs. Also, if I go to an invalid address (such as dev.mydomain.com/non-existant-page), I see a code-server 404 error page.

If I go to mydomain.com:8080, the site works fine.

code-server service start command: /usr/lib/code-server/lib/node /usr/lib/code-server --bind-addr 192.168.1.200:8080 --user-data-dir /var/lib/code-server --auth password

Could anyone please help? I'm not sure if the problem is with my Apache config or with code-server config.

You must be logged in to vote

Are there any browser logs or server logs you can share? That may help.

Replies: 1 comment 5 replies

Comment options

Are there any browser logs or server logs you can share? That may help.

You must be logged in to vote
5 replies
Comment options

IMG_20210628_141018_043.jpg

Everything crossed out is my domain name.

Comment options

That's helpful! navigator is undefined 🤔 What version of code-server are you using?

Can you try using the latest version? Also it seems like the WebSockets are failing? Do you need to enable them on your host?

Comment options

I'm using version 3.10.2.
I will look into websockets.

Comment options

I enabled Apache proxy_wstunnel module and now it's working, thanks!

Comment options

Hooray! Go team!

Answer selected by jsjoeio
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 によって変換されたページ (->オリジナル) /