Page MenuHomePhabricator

Certain image URL schemes are being (re)written to 'http' in production
Closed, ResolvedPublic

Description

I've noticed an odd discrepancy in service responses between local and the Beta Cluster on the one hand, and production on the other: the http: scheme is being prepended or, apparently in some cases, rewritten from https.

Two examples:

From /page/mobile-sections-lead/Barack_Obama:

Beta Cluster/Local (expected):

"image": {
  "file": "President_Barack_Obama.jpg",
  "urls": {
    "320": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/320px-President_Barack_Obama.jpg",
    "640": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/640px-President_Barack_Obama.jpg",
    "800": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/800px-President_Barack_Obama.jpg",
    "1024": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/820px-President_Barack_Obama.jpg"
  }
},

Prod (unexpected):

"image": {
  "file": "President_Barack_Obama.jpg",
  "urls": {
    "320": "http://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/320px-President_Barack_Obama.jpg",
    "640": "http://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/640px-President_Barack_Obama.jpg",
    "800": "http://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/800px-President_Barack_Obama.jpg",
    "1024": "http://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/820px-President_Barack_Obama.jpg"
  }
},

From /page/summary/Barack_Obama:

Beta Cluster/Local (expected):

"thumbnail": {
  "source": "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/256px-President_Barack_Obama.jpg",
  "width": 256,
  "height": 320,
  "original": "https://upload.wikimedia.org/wikipedia/commons/8/8d/President_Barack_Obama.jpg"
},

Prod (unexpected):

"thumbnail": {
  "source": "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/256px-President_Barack_Obama.jpg",
  "width": 256,
  "height": 320, 
  "original": "http://upload.wikimedia.org/wikipedia/commons/8/8d/President_Barack_Obama.jpg"
},

Event Timeline

Mholloway renamed this task from Certain image URL scheme are being (re)written to 'http' in production to Certain image URL schemes are being (re)written to 'http' in production.Sep 19 2017, 8:42 PM
Mholloway updated the task description. (Show Details)
mobrovac subscribed.

The main reason for this is that the MW API returns http origins for images. For the RESTBase side, I have created PR #865 to encompass the original field as well, which should fix the problem in the summary end point, but for mobile-sections a similar hack will need to be placed in the MCS.

Change 379237 had a related patch set uploaded (by Mholloway; owner: Mholloway):
[mediawiki/services/mobileapps@master] Fix: Rewrite http URLs to https in buildLeadImageUrls

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

Change 379237 merged by jenkins-bot:
[mediawiki/services/mobileapps@master] Rewrite lead image URLs to https and bump mobile-sections to 0.12.4

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

Stashbot subscribed.

Mentioned in SAL (#wikimedia-operations) [2017-09-20T20:34:46Z] <bsitzmann@tin> Started deploy [mobileapps/deploy@e23bf66]: Update mobileapps to d46860e (T175759 T176263)

Mentioned in SAL (#wikimedia-operations) [2017-09-20T20:40:51Z] <bsitzmann@tin> Finished deploy [mobileapps/deploy@e23bf66]: Update mobileapps to d46860e (T175759 T176263) (duration: 06m 05s)

The fix for the summary end point in RB has been merged and deployed.