Lucas_Werkmeister_WMDE created this task.
Lucas_Werkmeister_WMDE added projects: User-Daniel, Wikidata, MediaWiki-General-or-Unknown.

TASK DESCRIPTION

Currently, accessing data on commons via the canonical URI eventually ends up at index.php?action="">:

Special:PageData adds an Access-Control-Allow-Origin: * header to its redirect, but there is no such header on the first redirect, nor on the final response, which means that the request is blocked. (Aside: if I understand correctly, Firefox doesn’t yet support CORS on redirects at all. See Bug 1346749.) To enhance availability of these data, there should be a way for other websites to dynamically access the data in a way where the response can be cached.

There is a workaround to this problem: use the Action API (which supports CORS), with action="">, prop=revisions, and rvprop=content (and selecting the pages with titles, pageids, or some generator, etc.), and extract the page content from response.query.pages.{pageId}.revisions[0]['*']. However, API responses are never cached, resulting in more work for the API servers as well as lots of unnecessary data transfer. (It also requires that you parse and transform the canonical URI, which is ugly.)

As far as I understand, this will definitely require at least an Access-Control-Allow-Origin: * header on the /data/main, redirect, which can be added like this. After that, there are different options. We can make index.php send that header as well on any successful GET request to the Data: namespace, but this seems a bit risky. Alternatively, we could make Special:PageData redirect to something other than index.php?action=""> (which isn’t a very nice solution anyways), e. g. an endpoint of the REST API. The REST API already supports the endpoint /page/wikitext/{title}, but only for POST requests. We could add support for GET requests to it, or perhaps add another endpoint (after all, the content model isn’t actually wikitext).




To: Lucas_Werkmeister_WMDE
Cc: daniel, Aklapper, Jdforrester-WMF, Smalyshev, Lucas_Werkmeister_WMDE, Dfil7, Icedevil, GoranSMilovanovic, 45Jayjay1969, QZanden, Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to