diff --git a/doc/self-hosted/index.md b/doc/self-hosted/index.md index 742d9ebe..594c8c91 100644 --- a/doc/self-hosted/index.md +++ b/doc/self-hosted/index.md @@ -89,6 +89,30 @@ OPTIONS } } ``` + + ### Apache Reverse Proxy + Example of https virtualhost configuration for Apache as a reverse proxy. Please also pass --allow-http on code-server startup to allow the proxy to connect. + ``` + + ServerName code.example.com + 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] + + ProxyRequests off + + RequestHeader set X-Forwarded-Proto https + RequestHeader set X-Forwarded-Port 443 + + ProxyPass / http://localhost:8443/ nocanon + ProxyPassReverse / http://localhost:8443/ + + + ``` + *Important:* For more details about Apache reverse proxy configuration checkout the [documentation](https://httpd.apache.org/docs/current/mod/mod_proxy.html) - especially the [Securing your Server](https://httpd.apache.org/docs/current/mod/mod_proxy.html#access) section + ### Help - Use `code-server -h` or `code-server --help` to view the usage for the cli. This is also shown at the beginning of this section. + Use `code-server -h` or `code-server --help` to view the usage for the cli. This is also shown at the beginning of this section.