Page MenuHomePhabricator

UrlShortener-shortened URLs require two redirects to dereference
Open, LowPublic

Description

Example: http://us.wmflabs.org/a redirects to http://us.wmflabs.org/wiki/Special:UrlRedirector/a which redirects to the actual link target, http://en.wikipedia.org, which redirects to https://en.wikipedia.org/, which redirects to https://en.wikipedia.org/wiki/Main_Page. That's 4 redirects!

We can eliminate the first redirect at the Apache layer. The latter three could be eliminated if UrlShortener fetched the target URLs, following any HTTP 301 responses, and using the final target URL as the short URL target.

Related Objects

Event Timeline

ori created this task.Aug 10 2015, 6:11 PM
ori raised the priority of this task from to Low.
ori updated the task description. (Show Details)
ori added subscribers: ori, Legoktm.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 10 2015, 6:11 PM
ori added a comment.Aug 10 2015, 6:13 PM

(This is not a deployment blocker, IMO.)

The first redirect to UrlRedirector isn't supposed to happen, but the labs wiki setup is a bit of a hack (P1543).

The last HTTP -> HTTPS redirect won't happen in Wikimedia production since UrlShortener redirects using the current protocol, and the short domain will be HTTPS-only.

I believe the original issue might have been fixed.

$ wget --max-redirect=0 "https://w.wiki/w" 
--2019-04-14 01:42:21--  https://w.wiki/w
Resolving w.wiki (w.wiki)... 103.102.166.224
Connecting to w.wiki (w.wiki)|103.102.166.224|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.wikipedia.org/ [following]
0 redirections exceeded.