Help with apache reverse proxy to get SSL for my Owncast stream server

I succeeded on steps 1-3
https://live.pastlife.works/ is up with a simple page

I'm not sure how to edit the example from Owncast's docs

le-ssl.conf for my subdomain looks like this:

<IfModule mod_ssl.c>
<VirtualHost *:443>
	ServerName live.pastlife.works
	ServerAdmin email
        ServerAlias live.pastlife.works	
	DocumentRoot /var/www/live.pastlife.works
		
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

##//Owncast config//##
       ProxyRequests       Off
       ProxyPreserveHost   On
       AllowEncodedSlashes NoDecode

       <Proxy *>
       Order deny,allow
       Allow from all
       </Proxy>

       ProxyPass        / http://localhost:8080/
       ProxyPassReverse / http://localhost:8080/

       RequestHeader    set X-Forwarded-Proto "https"
       RequestHeader    set X-Forwarded-Port "443"

       # setup the proxy to forward websocket requests properly
       # (note: this proxy automatically converts the secure websocket (wss)
       # to a normal websocket and vice versa.

       RewriteEngine On
       RewriteCond %{HTTP:UPGRADE} ^WebSocket$           [NC,OR]
       RewriteCond %{HTTP:CONNECTION} ^Upgrade$          [NC]
       RewriteRule .* ws://127.0.0.1:8080%{REQUEST_URI}  [P,QSA,L]
##//Owncast config//##

SSLCertificateFile /etc/letsencrypt/live/live.pastlife.works/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/live.pastlife.works/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

If I omit everything inside what I marked ##//Owncast config//## I can visit the subdomain, if I include it, it breaks apache completely and I cant visit any domain on the server.

Probably because I didnt understand the lines that Owncast wrote

I dont get what this is asking me to do:

setup the proxy to forward websocket requests properly
(note: this proxy automatically converts the secure websocket (wss)
to a normal websocket and vice versa.

Thank you so much for your help

2 Likes