-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Using code-server Reverse Proxy on Apache2 VirtualHost #3667
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
Are there any browser logs or server logs you can share? That may help.
Replies: 1 comment 5 replies
-
Are there any browser logs or server logs you can share? That may help.
Beta Was this translation helpful? Give feedback.
All reactions
-
Everything crossed out is my domain name.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
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?
Beta Was this translation helpful? Give feedback.
All reactions
-
I'm using version 3.10.2.
I will look into websockets.
Beta Was this translation helpful? Give feedback.
All reactions
-
I enabled Apache proxy_wstunnel
module and now it's working, thanks!
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 1
-
Hooray! Go team!
Beta Was this translation helpful? Give feedback.