FreedomBox/data/etc/apache2/conf-available/freedombox-tls.conf
Sunil Mohan Adapa d6131df6a8
apache: Also configure to serve on /freedombox
This is useful mostly for future when we may switch from /plinth to /freedombox.

Tests:

- Accessing /freedombox/app/transmission works. Although redirects generated by
the FreedomBox web service still redirect to /plinth. For example, redirection
after logout and auto-redirection to login page.

- Accessing pages of FreedomBox works as usual on /plinth and /freedombox.
Content-Security-Policy is set.

- Accessing /foo/plinth/app/transmission throws 404.

- Accessing http:// redirects to https:// for /plinth and /freedombox.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-17 12:07:55 -04:00

18 lines
623 B
Plaintext

##
## Allow only TLS traffic onto FreedomBox service. This is done by redirecting
## non-secure traffic to secure traffic. The redirect is permanent as
## recommended in: http://tools.ietf.org/html/rfc6797#section-7
##
## Requires the following Apache modules to be enabled:
## mod_rewrite
## mod_ssl
##
<LocationMatch "^/(plinth|freedombox)">
RewriteEngine on
# Don't redirect for onion sites as it is not needed and leads to
# unnecessary warning.
RewriteCond %{HTTP_HOST} !^.*\.onion$ [NC]
ReWriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</LocationMatch>