Skip to content

Instantly share code, notes, and snippets.

@edalquist
Created April 16, 2019 02:25
Show Gist options
  • Select an option

  • Save edalquist/dafb6e7b4f359c1cd2e0f0b2e5b01c8d to your computer and use it in GitHub Desktop.

Select an option

Save edalquist/dafb6e7b4f359c1cd2e0f0b2e5b01c8d to your computer and use it in GitHub Desktop.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName tautulli.home.example.com
Redirect permanent / https://tautulli.home.example.com/
CustomLog ${APACHE_LOG_DIR}/tautulli.home.example.com.log vhost_combined
ErrorLog ${APACHE_LOG_DIR}/tautulli.home.example.com_error.log
</VirtualHost>
<VirtualHost *:443>
ServerName tautulli.home.example.com
# Enable request rewriting for proxy (mod_rewrite)
RewriteEngine On
# Rewrite requests with a Upgrade=websocket header to the ws port (mod_proxy_wstunnel)
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://media:8181/$1 [P,L]
# Rewrite requests without a Upgrade=websocket header to the http port (mod_proxy)
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://media:8181/$1 [P,L]
ProxyPassReverse / http://media:8181/
# Rewrite the localIp variable to use the page host
AddOutputFilterByType INFLATE;SUBSTITUTE;DEFLATE text/html text/plain text/xml
Substitute "s|var localIp = \"[^\"]+\"|var localIp = window.location.host|i"
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/home.example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/home.example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/home.example.com/chain.pem
# HSTS (mod_headers is required) (15768000 seconds = 6 months)
Header always set Strict-Transport-Security "max-age=15768000"
CustomLog ${APACHE_LOG_DIR}/tautulli.home.example.com.log vhost_combined
ErrorLog ${APACHE_LOG_DIR}/tautulli.home.example.com_error.log
<Location />
AuthType openid-connect
Require claim email:[email protected]
</Location>
<Location /js/>
OIDCUnAuthAction pass
</Location>
<Location /css/>
OIDCUnAuthAction pass
</Location>
<Location /images/>
OIDCUnAuthAction pass
</Location>
<Location /fonts/>
OIDCUnAuthAction pass
</Location>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment