Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / applications / vpn-settings / src / .htaccess
blob32bde0fa6afba4a8954e9e00edb134332f7f83dd
1 RewriteEngine On
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
10 DirectorySlash Off
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]
17 RewriteCond %{REQUEST_FILENAME} -d
18 RewriteRule (.*) $1/index.html [L]
20 RewriteCond %{REQUEST_FILENAME} !-f
21 RewriteRule (.*) /index.html [L]
23 ErrorDocument 404 /assets/404.html
25 <Files index.html>
26     RewriteCond %{HTTP_HOST} join.protonvpn.com
27     RewriteRule (.*)/index.html $1/index.convert.html [L]
28 </Files>
30 <Files ~ "(\.html|version.json)">
31     FileETag None
32     Header unset ETag
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"
36 </Files>
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
47 </Files>
49 <IfModule mod_deflate.c>
50   AddOutputFilter INCLUDES;DEFLATE svg
51 </IfModule>