Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vhosting #66

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Detect HTTPS

SetEnvIfNoCase X-HTTPS-Session Yes is_ssl=yes
SetEnvIfNoCase X-HTTPS-Session Yes is_https=yes
SetEnvIfNoCase X-HTTPS-Session Yes HTTPS=on

# Security headers

Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"
Header always append X-Frame-Options DENY
Header set X-Content-Type-Options nosniff
Expand All @@ -6,4 +14,21 @@ Header set Content-Security-Policy "default-src 'none'; font-src 'self'; img-src

Header always set Referrer-Policy "same-origin"

ErrorDocument 404 /404.html
# Error document
ErrorDocument 404 /404.html

# Redirect http -> https
RewriteCond %{HTTP:X-HTTPS-SESSION} !^yes$
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,QSA]

# Block requests not for vintage.divd.nl
RewriteCond %{HTTP_HOST} !^vintage.divd.nl
RewriteRule (.*) - [r=404]

# Handle requests to directories without trailing slash
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule (.*[^\/])$ https://vintage.divd.nl/$1/ [L,r=301,QSA]

# Redirect requests directly to https://vintage.divd.nl/www-divd-nl/...
RewriteCond %{THE_REQUEST} ^\w+\s+/?csirt-divd-nl
RewriteRule (.*) https://vintage.divd.nl/$1 [L,r=301,QSA]
Loading