3 # Redirect to https if not coming from https && not forwarded from https && not curl nor any health check user-agent
4 RewriteCond %{HTTPS} !=on
5 RewriteCond %{HTTP:X-Forwarded-Proto} !=https
6 RewriteCond %{HTTP_USER_AGENT} !(^kube-probe|^GoogleHC|^curl)
7 RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
9 RewriteOptions AllowNoSlash
12 # Ignore any requests to the assets folder, to avoid the index.html fallback and return 404 there
13 RewriteRule ^assets/ - [L]
15 RewriteRule ^(.*)/$ /$1 [L,R=301]
18 RewriteRule ^oauth/callback /oauth.html [L]
20 RewriteRule ^u/ /private.html [L]
22 RewriteCond %{REQUEST_FILENAME} -d
23 RewriteRule (.*) $1/index.html [L]
25 RewriteCond %{REQUEST_FILENAME} !-f
26 RewriteRule (.*) /index.html [L]
28 ErrorDocument 404 /assets/404.html
30 <Files ~ "(\.html|version.json)">
33 Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
34 Header set Pragma "no-cache"
35 Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
38 <Files ~ "\.(ttf|otf|eot|woff|woff2)$">
39 # Take out the subdomain part (proton.me) of for example
40 # Origin: https://account-api.proton.me
41 # Host: account.proton.me
42 SetEnvIf Origin "^[^.]+\.(.*)$" origin=$0 origin_domain=$1
43 SetEnvIf Host "^[^.]+\.(.*)$" server_name_domain=$1
44 # Compare the subdomain variables
45 SetEnvIfExpr "reqenv('origin_domain') == reqenv('server_name_domain')" match=true
46 Header set Access-Control-Allow-Origin "%{origin}e" env=match
49 <IfModule mod_deflate.c>
50 AddOutputFilter INCLUDES;DEFLATE svg