Write a PHP API in the Parsoid extension that other extensions can use to send requests to Parsoid. Include cookie forwarding for private wiki support.arsoid backend for VirtualRestService, Right now bothand replace VisualEditor's and Flow implement this separately to varying degrees,'s hacks with that. this API should replace thatIncorporate the cookie forwarding hacks from VE as well.
See https://www.mediawiki.org/wiki/Requests_for_comment/PHP_Virtual_REST_Service and https://github.com/wikimedia/mediawiki/tree/master/includes/libs/virtualrest
This would also be a good opportunity to clean up the rather messy config variable landscape for Parsoid-related settings in VisualEditor, Flow andway the Parsoid URL (and whether it's available) is configured in mediawiki-config.