Skip to content

unable to hide behind apache proxypass, websocket has error #442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
peterremote1980 opened this issue Apr 5, 2019 · 6 comments
Closed
Labels
bug Something isn't working waiting-for-info Waiting for more information from submitter

Comments

@peterremote1980
Copy link

unable to hide behind apache proxypass, websocket has error:

c01964.bundle.js:53 WebSocket connection to 'wss://code.quantr.hk/' failed: Error during WebSocket handshake: Unexpected response code: 200

<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName code.quantr.hk
        ServerAlias code.quantr.com
        ProxyPass / http://192.168.10.124:8443/
        ProxyPassReverse / http://192.168.10.124:8443/
</VirtualHost>



<VirtualHost *:443>
            ProxyRequests Off

    SSLEngine On
    SSLProxyEngine On
    SSLProxyVerify none
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off

        SSLCertificateFile /etc/letsencrypt/live/mail.findjob.la/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/mail.findjob.la/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf

        ServerAdmin [email protected]
        ServerName code.quantr.hk
        ServerAlias code.quantr.com
        ProxyPass / https://192.168.10.124:8443/
        ProxyPassReverse / https://192.168.10.124:8443/
</VirtualHost>
/root/Downloads/code-server1.604-vsc1.32.0-linux-x64/code-server  -P password --cert /etc/letsencrypt/live/mail.findjob.la/fullchain.pem --cert-key /etc/letsencrypt/live/mail.findjob.la/privkey.pem ~/workspace/
@peterremote1980 peterremote1980 added the bug Something isn't working label Apr 5, 2019
@kylecarbs kylecarbs added the waiting-for-info Waiting for more information from submitter label Apr 5, 2019
@edwinbrowwn
Copy link

edwinbrowwn commented Apr 5, 2019

What modules are are you using with apache?
Don't forget to open port 8443.

@peterremote1980
Copy link
Author

I am using ProxyPass module, i confirm 8443 is opened.

@edwinbrowwn
Copy link

edwinbrowwn commented Apr 5, 2019

ProxyPass is just an argument in the config. Make sure you have the respective apache modules installed to support headers and such.
Here is the command to install the mod_prox module.
apt install -y build-essential
apt install -y libapache2-mod-proxy-html libxml2-dev
a2enmod
proxy proxy_ajp proxy_http rewrite deflate headers proxy_connect proxy_html
You will then see a list of modules you can install. Then restart after you have what you need.

@abl
Copy link

abl commented Apr 7, 2019

https://github.com/codercom/code-server/blob/master/doc/self-hosted/index.md#apache-reverse-proxy

Take a look at that; you're missing a few config directives that are causing your websockets to be treated like normal HTTP requests. (Unexpected response code: 200 means that your websocket request is getting a normal web page back.)

@sr229
Copy link
Contributor

sr229 commented Apr 9, 2019

From first glance your configuration does not support HTTP upgrades, which the websocket needs.

@ColdSphinX
Copy link

ColdSphinX commented Apr 15, 2019

You might want to use rewrite to proxy depending on http upgrade.

RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://192.168.10.124:8443/$1 [P,QSA,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://192.168.10.124:8443/$1 [P,QSA,L]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting-for-info Waiting for more information from submitter
Projects
None yet
Development

No branches or pull requests

7 participants