Parsoid JS's endpoints include the domain of the project in the path. We need to figure out how to handle this when the API provider is MediaWiki instead.
Description
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | ssastry | T229015 Tracking: Direct live production traffic at Parsoid/PHP | |||
Resolved | EvanProdromou | T221158 Parsoid REST API in PHP | |||
Resolved | EvanProdromou | T221173 Resolve domains in path of endpoints for Parsoid REST API | |||
Resolved | • Pchelolo | T224487 Make RESTBase take full request template for Parsoid requests |
Event Timeline
MediaWiki will likely have already been set up based on the incoming request and re-initializing it for a different site-configuration seems likely to be complicated and fragile. It might be better if we can decline this task.
All MediaWiki appservers contain the code and configuration for all wikis and select which one to apply based on the Host header. In theory that logic could be amended to handle Parsoid REST URLs with domains in them, but it would be confusing, would add extra complexity for no good reason, and would not work for third parties (wikifarm management is not standardized, every farm handles multi-wiki configuration in their own way). Also makes cookie-based authentication complicated (if not impossible). Changing what URLs RESTBase and the MediaWiki virtual REST service send to seems far simpler.
@mobrovac and @Pchelolo it'd be helpful here to make sure we're doing this right.
My understanding is that the rest router* uses URLs to the Parsoid JS service like this example:
${parsoidHost}/${domain}/v3/transform/html/to/wikitext
Ideally, we'd get MediaWiki invoked with the right configuration for domain and a path like /w/rest.php/v3/transform/html/to/wikitext.
I guess the question is, is there a value for parsoidHost that we can set for the rest router that does what we want? Or do we have to change the way that REST-router builds its Parsoid service URLs, so it can handle both the current ParsoidJS world and future ParsoidPHP world?
- Here, REST router == recently separated component of RESTBase that provides routing services; distinct from the router in rest.php, and yes I know it's very confusing.
In theory that logic could be amended to handle Parsoid REST URLs with domains in them, but it would be confusing, would add extra complexity for no good reason, and would not work for third parties
Totally agree.
Ideally, we'd get MediaWiki invoked with the right configuration for domain and a path like /w/rest.php/v3/transform/html/to/wikitext.
Yes. And the host header.
Or do we have to change the way that REST-router builds its Parsoid service URLs, so it can handle both the current ParsoidJS world and future ParsoidPHP world?
Basically, we need this to be configurable. So, parsoid.js in RESTBase(rest-router) will receive a parsoidRequestTemplate instead of just the Parsoid host. That would allow us to configure how exactly we're calling parsoid per RB installation.