Page MenuHomePhabricator

[Cloud] Enable CORS on wikistats.wmflabs.org
Closed, ResolvedPublic

Description

Hello, and a thousand apologies if I'm in the wrong place to ask about this.

I'm making a web-based tool that makes a web request to a CSV file at
https://wikistats.wmflabs.org — however, because that webserver hasn't
enabled CORS (cross-origin resource sharing), most browsers can't
fetch the file.

To see this, open your browser to any non-WMFlabs.org URL (like
github.com), then open the JavaScript Console, and type in the
following:

fetch('https://wikistats.wmflabs.org/api.php?action=dump&table=wikipedias&format=csv').then(res
=> res.json()).then(x=>console.log(x))

Firefox for example will tell you, "Cross-Origin Request Blocked: The
Same Origin Policy disallows reading the remote resource at
https://wikistats.wmflabs.org/api.php?action=dump&table=wikipedias&format=csv.
(Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
TypeError: NetworkError when attempting to fetch resource."

Assuming Wikistats, the Cloud team, and the Wikimedia Foundation *do*
indeed want this data to be loadable by JavaScript running on any
domain, the standard way to fix this is to add the
"Access-Control-Allow-Origin: *" header to all responses sent by the
webserver. More detail is available at https://enable-cors.org/

I dug around for a while looking for a way to reach someone who might
be in charge of the https://wikistats.wmflabs.org webserver, and if
I'm in the wrong place, please accept my apologies.

Many thanks for your hard work,

Ahmed

Event Timeline

Dzahn created this task.Apr 25 2018, 10:03 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 25 2018, 10:03 PM
Dzahn updated the task description. (Show Details)Apr 25 2018, 10:03 PM
Dzahn added a subscriber: Aldebrn.
Dzahn removed a subscriber: Dzahn.

Hi @Aldebrn You are the same Ahmed Fasih who reported this issue, am i right? I just saw your email today and created this ticket as a reminder.

Dzahn claimed this task.Apr 25 2018, 10:05 PM

@Dzahn yes, this is me, Aldebrn, also known as Ahmed Fasih. Thank you!!!

Change 429535 had a related patch set uploaded (by Dzahn; owner: Dzahn):
[operations/debs/wikistats@master] enable CORS on api.php

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

Change 429535 merged by jenkins-bot:
[operations/debs/wikistats@master] enable CORS on api.php

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

@Dzahn 🙌! Thank you 🙏! Works great 😁!

Dzahn added a comment.Apr 30 2018, 3:56 PM

@Aldebrn great! thanks for confirming. I wonder if we can close the ticket or if i need to add the header to other php files besides api.php. I'll keep it open to take another look, for now.

Change 430445 had a related patch set uploaded (by Dzahn; owner: Dzahn):
[operations/debs/wikistats@master] add CORS (cross-origin resource sharing) header to more files

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

Change 430445 merged by Dzahn:
[operations/debs/wikistats@master] add CORS (cross-origin resource sharing) header to more files

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

Dzahn closed this task as Resolved.May 2 2018, 8:15 PM
Vvjjkkii renamed this task from [Cloud] Enable CORS on wikistats.wmflabs.org to l7daaaaaaa.Jul 1 2018, 1:14 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii triaged this task as High priority.
Vvjjkkii removed Dzahn as the assignee of this task.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii edited subscribers, added: Dzahn; removed: gerritbot, Aklapper.
AfroThundr3007730 renamed this task from l7daaaaaaa to [Cloud] Enable CORS on wikistats.wmflabs.org.Jul 1 2018, 6:02 AM
AfroThundr3007730 closed this task as Resolved.
AfroThundr3007730 raised the priority of this task from High to Needs Triage.
AfroThundr3007730 assigned this task to Dzahn.
AfroThundr3007730 updated the task description. (Show Details)
AfroThundr3007730 edited subscribers, added: GerritBot, Aklapper; removed: Dzahn.