Skip to content

Commit

Permalink
ci: update htaccess (monicahq/chandler#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Jan 8, 2023
1 parent a90c413 commit dd67f3f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
11 changes: 11 additions & 0 deletions public/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect .well-known urls (https://en.wikipedia.org/wiki/List_of_/.well-known/_services_offered_by_webservers)
RewriteCond %{REQUEST_URI} .well-known/carddav
RewriteRule ^ /dav/ [L,R=301,N]

RewriteCond %{REQUEST_URI} .well-known/caldav
RewriteRule ^ /dav/ [L,R=301,N]

RewriteCond %{REQUEST_URI} .well-known/security.txt
RewriteRule ^ /security.txt [L,R=301,N]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !dav/*
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

Expand Down
4 changes: 4 additions & 0 deletions public/security.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Our security address

Contact: security@monicahq.com
Disclosure: Full
19 changes: 15 additions & 4 deletions resources/.htaccess_production
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

RewriteEngine On

# Redirect to https
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,N]

<IfModule mod_headers.c>
# Activate HSTS
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload;"
Expand All @@ -27,12 +23,27 @@
</filesMatch>
</IfModule>

# Redirect to https
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,N]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect .well-known urls (https://en.wikipedia.org/wiki/List_of_/.well-known/_services_offered_by_webservers)
RewriteCond %{REQUEST_URI} .well-known/carddav
RewriteRule ^ /dav/ [L,R=301,N]

RewriteCond %{REQUEST_URI} .well-known/caldav
RewriteRule ^ /dav/ [L,R=301,N]

RewriteCond %{REQUEST_URI} .well-known/security.txt
RewriteRule ^ /security.txt [L,R=301,N]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !dav/*
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

Expand Down

0 comments on commit dd67f3f

Please sign in to comment.