Page MenuHomePhabricator

Apache slash expansion should not redirect from HTTPS to HTTP
Closed, ResolvedPublic

Description

Accessing a url https://integration.wikimedia.org/cover/cdb

Result in

https://integration.wikimedia.org/cover/cdb
Remote port: 443
 301 Moved Permanently
 Location: http://integration.wikimedia.org/cover/cdb/

http://integration.wikimedia.org/cover/cdb/
Remote port: 80
 301 Moved Permanently
 Location: https://integration.wikimedia.org/cover/cdb/

https://integration.wikimedia.org/cover/cdb/
Remote port: 443
 200 OK

Event Timeline

Krinkle raised the priority of this task from to Needs Triage.
Krinkle updated the task description. (Show Details)
Krinkle subscribed.
Krinkle renamed this task from Apache slash expansion incorrectly redirects from HTTPS to HTTP to Apache slash expansion should not redirect from HTTPS to HTTP.Apr 6 2015, 12:39 PM
Krinkle set Security to None.
Andrew triaged this task as High priority.Apr 11 2015, 9:29 PM

Change 206460 had a related patch set uploaded (by Dzahn):
integration: Apache turn DirectorySlash Off

https://gerrit.wikimedia.org/r/206460

so either we just turn of DirectorySlash or if we care to keep it, we additionally add "manual" rewrite rules to replace that feature but with the right protocol. (RewriteCond %{REQUEST_FILENAME} -d .. RewriteRule ^(.+[^/])$ https://www.example.com/$1/ [R=301,L,QSA] )

Change 206832 had a related patch set uploaded (by Dzahn):
doc.wikimedia.org: fix DirectorySlash https->http

https://gerrit.wikimedia.org/r/206832

Dzahn lowered the priority of this task from High to Medium.Apr 29 2015, 1:58 AM

Change 206832 merged by Dzahn:
doc.wikimedia.org: fix DirectorySlash https->http

https://gerrit.wikimedia.org/r/206832

Change 206460 merged by Dzahn:
integration: Apache turn DirectorySlash Off

https://gerrit.wikimedia.org/r/206460

reverted on integration:

same config that works on doc.wm , but here:

after:
<h1>Forbidden</h1>
<p>You don't have permission to access /cover/cdb

back to:

curl -vv https://integration.wikimedia.org/cover
<p>The document has moved <a href="http://integration.wikimedia.org/cover/">here</a>.</p>

Is this due to .htaccess files that don't come from puppet competing with the global Apache config?

Dzahn removed Dzahn as the assignee of this task.May 6 2015, 8:33 PM

TLDR: i fixed it on doc.wikimedia.org but it should still be fixed on integration.wikimedia.org

This comment has been deleted.

Nowadays:

curl https://integration.wikimedia.org/cover/cdb
<p>The document has moved <a href="https://doc.wikimedia.org/cover/cdb">here</a>.</p>

curl http://integration.wikimedia.org/cover/cdb/
... (nothing?) but in browser i get https://doc.wikimedia.org/cover/cdb/

curl https://integration.wikimedia.org/cover/cdb/
<p>The document has moved <a href="https://doc.wikimedia.org/cover/cdb/">here</a>.</p>

So it redirects to doc.wm.org and there is no more HTTPS to HTTP here

Change 483775 had a related patch set uploaded (by Hashar; owner: Hashar):
[operations/puppet@production] doc: fix redirect of dir lacking a trailing slash

https://gerrit.wikimedia.org/r/483775

Change 483775 merged by Dzahn:
[operations/puppet@production] doc: fix Apache redirects to use https

https://gerrit.wikimedia.org/r/483775

DirectorySlash redirecting to http instead of canonical https is Upstream Apache bug 61355 - DirectorySlash directive should use protocol in X-Forwarded-Proto header when available. We fixed it by adding the protocol scheme in the ServerName: ServerName https://doc.wikimedia.org.