Files
configpolicy/roles/jellyfin/templates/jellyfin.httpd.conf.j2
Dustin C. Hatch 1b63332872 r/jellyfin: Restrict HTTPS redirect to Jellyfin
Since Jellyfin is running on the file server, which also hosts a few
other websites that do not define virtual hosts, the HTTP-to-HTTPS
redirect was applied to *all* requests.  To avoid this, we simply add a
rewrite condition so that the redirect only applies to requests for
Jellyfin.
2023-09-13 10:06:12 -05:00

29 lines
876 B
Django/Jinja

<VirtualHost _default_:80>
ServerName {{ jellyfin_server_name }}
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{SERVER_NAME} {{ jellyfin_server_name }}
RewriteRule /.* https://%{SERVER_NAME}$0 [R=301,L]
</VirtualHost>
<VirtualHost _default_:443>
ServerName {{ jellyfin_server_name }}
SSLCertificateFile {{ jellyfin_ssl_certificate }}
SSLCertificateKeyFile {{ jellyfin_ssl_certificate_key }}
SSLCertificateChainFile {{ jellyfin_ssl_certificate }}
ProxyPreserveHost On
ProxyRequests Off
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:8096/$1 [P,L]
RewriteRule /(.*) http://localhost:8096/$1 [P,L]
ProxyPassReverse / http://localhost:8096/
Header always set \
Strict-Transport-Security "max-age=63072000; includeSubDomains"
</VirtualHost>