Dzahn has submitted this change and it was merged.

Change subject: integration: Apache turn DirectorySlash Off
......................................................................


integration: Apache turn DirectorySlash Off

T95164 reported how, if an URL ends in a directory without ending in a /,
we are getting 301 redirects to http links. This results in https->http 
redirects.

This is not from individual rewrite rules but it's a feature of mod_dir called
DirectorySlash and it's on by default.

This turns that feature off for the entire VirtualHost, but adds redirect rules
to achieve the same effect while using https.

http://httpd.apache.org/docs/current/mod/mod_dir.html#directoryslash

Bug: T95164
Change-Id: I577c65b5021b9b9cec7b373ed59e88934334cf5c
---
M modules/contint/templates/apache/integration.wikimedia.org.erb
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/modules/contint/templates/apache/integration.wikimedia.org.erb 
b/modules/contint/templates/apache/integration.wikimedia.org.erb
index fe20e6c..181f6d9 100644
--- a/modules/contint/templates/apache/integration.wikimedia.org.erb
+++ b/modules/contint/templates/apache/integration.wikimedia.org.erb
@@ -14,11 +14,17 @@
     DocumentRoot /srv/org/wikimedia/integration
 
     RewriteEngine On
+
     RewriteRule ^/favicon\.ico$ /favicon.php [L]
     # Force any request to HTTPS if not passed via https (misc web varnish)
     RewriteCond %{HTTP:X-Forwarded-Proto} !https
     RewriteRule (.) https://integration.wikimedia.org%{REQUEST_URI} [R=301]
 
+    # T95164
+    DirectorySlash Off
+    RewriteCond %{REQUEST_FILENAME} -d
+    RewriteRule ^(.+[^/])$ https://integration.wikimedia.org/$1/ [R=301,QSA]
+
     Redirect 301 /monitoring/ 
https://tools.wmflabs.org/nagf/?project=integration
 
     Header always merge Vary X-Forwarded-Proto

-- 
To view, visit https://gerrit.wikimedia.org/r/206460
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I577c65b5021b9b9cec7b373ed59e88934334cf5c
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: Glaisher <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to