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
Description
Details
Related Objects
Event Timeline
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.
Change 429535 had a related patch set uploaded (by Dzahn; owner: Dzahn):
[operations/debs/wikistats@master] enable CORS on api.php
Change 429535 merged by jenkins-bot:
[operations/debs/wikistats@master] enable CORS on api.php
@Aldebrn please try again now. I added the header to api.php
It says "XHR status: 200" to me now on:
@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
Change 430445 merged by Dzahn:
[operations/debs/wikistats@master] add CORS (cross-origin resource sharing) header to more files