From 36ad2cf781d877b67d9b7848e7873dd1f207cdd2 Mon Sep 17 00:00:00 2001 From: lookas <15031653+hilookas@users.noreply.github.com> Date: Thu, 23 Jul 2020 10:57:41 +0800 Subject: [PATCH] Fix a bug of redirecting https to http (#208) --- public/.htaccess | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/.htaccess b/public/.htaccess index d92ef5c7..80307cf4 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -14,6 +14,12 @@ RewriteRule (^\.|/\.) - [F] RewriteRule ^storage/.* - [F] + # Redirect trailing slashes if not a folder (behind a reverse proxy) + RewriteCond %{HTTP:X-Forwarded-Proto} ^https$ + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_URI} (.+)/$ + RewriteRule ^ "%{HTTP:X-Forwarded-Proto}://%{HTTP_HOST}%1" [L,R=301] + # Redirect trailing slashes if not a folder RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$