Skip to content

Instantly share code, notes, and snippets.

@ymauray
Last active March 8, 2019 12:01
Show Gist options
  • Save ymauray/eb9181b80e2b4d462fc30b09cba06a5a to your computer and use it in GitHub Desktop.
Save ymauray/eb9181b80e2b4d462fc30b09cba06a5a to your computer and use it in GitHub Desktop.
Apache 2 config file to act as a reverse proxy for Visual Studio Code on the server
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName code.somehost.ch
ProxyRequests Off
AllowEncodedSlashes NoDecode
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:8443/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:8443/$1 [P,L]
ProxyPassReverse / http://localhost:8443/
ServerSignature Off
SSLCertificateFile /etc/letsencrypt/live/code.somehost.ch/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/code.somehost.ch/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment