Feature summary (what you would like to be able to do and where):
When user adds a sitelink to a specific Wikibase item, it seems the following functions will be called in order to retrieve the normalized page title from the "target MediaWiki site" via api.php.
- SiteLinkPageNormalizer::normalize
- MediaWikiSite::normalizePageName
- MediaWikiPageNameNormalizer::normalizePageName
This task requests for a feature to let us specify one or more constant header-value pairs that should be included as HTTP request headers when sending api.php requests to one or more specific "target MediaWiki site"s. I'm not familiar with PHP syntax, but what I'm having in mind is something like this in LocalSettings.php
$wgSiteConfiguration["targetwiki"]["requestHeaders"]["Header-1"] = "header-value-1"; $wgSiteConfiguration["targetwiki"]["requestHeaders"]["Header-2"] = "header-value-2";
or some equivalent configuration in the sites table.
Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
Suppose we have set up our own MediaWiki site with Wikibase extension, and we have also set up the "target wiki sites" information in the sites table.
The "target wiki site" has set up some CAPTCHA on the gateway layer (e.g., Cloudflare), preventing bot abusing. It will basically reject all the requests unless we also include some specific headers for all the requests sent to that endpoint. This is currently causing issue for us as we don't have a direct approach to plug in the headers we want to send, and thus user won't be able to set up sitelinks for Wikibase items at all, due to the request error from SiteLinkPageNormalizer::normalize function.
Benefits (why should this be implemented?):
I'm not sure what are the feasible options for our usage scenario, but this feature request describes a most direct solution for us. I think we can also try to leverage existing configurations or hooks, but I'm not sure which configuration or hook to use.