skip to Main Content

I’ve installed mediawiki on an Amazon ec2 server.
The server has only apache, php, mariadb and mediawiki

I’m using mediawiki 1.35, with the bundled VisualEditor and ParsoidPHP
I can use VisualEditor to edit a new page, but it will not save, and when I edit an existing page, I get the blue progress bar followed by the error:
Error contacting the Parsoid/RESTBase server: (curl error: 28) Timeout was reached
I’ve tried configuring parsoid using instruction I’ve found on the web :

$wgVirtualRestConfig['modules']['parsoid'] = [
        // URL to the Parsoid instance - use port 8142 if you use the Debian package - the parameter 'URL' was first used but is now deprecated (string)
        'url' => 'http://myIpAddress:8000',
        // Parsoid "domain" (string, optional) - MediaWiki >= 1.26
        'domain' => 'myIpAddress',
        // Parsoid "prefix" (string, optional) - deprecated since MediaWiki 1.26, use 'domain'
        'prefix' => 'myIpAddress',
        // Forward cookies in the case of private wikis (string or false, optional)
        'forwardCookies' => true,
        // request timeout in seconds (integer or null, optional)
        'timeout' => null,
        // Parsoid HTTP proxy (string or null, optional)
        'HTTPProxy' => null,
        // whether to parse URL as if they were meant for RESTBase (boolean or null, optional)
        'restbaseCompat' => null,
];

The best effect I get is a 404, or a 400. This configuration is not working.
I haven’t made any other changes to the settings.

if I call parsoid directly:
http://MyIpAddress/api.php?action=visualeditor&paction=parse&page=Main_Page

I see the timeout thusly:

{
    "error": {
        "code": "apierror-visualeditor-docserver-http-error",
        "info": "Error contacting the Parsoid/RESTBase server: (curl error: 28) Timeout was reached",
        "*": "See http://MyIpAddress/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
    }
}

2

Answers


  1. Chosen as BEST ANSWER

    Based on my testing, it appears that parsoid is using the $wgServer variable to make a local connection to rest.php
    Using curl, I'm able to connect to http://localhost/rest.php/v1/page/Main_Page
    But, not to http://myipaddress/rest.php/v1/page/Main_Page or http://mydomainname/rest.php/v1/page/Main_Page both of these timeout. The apache server can't connect to itself
    So, theoretically, I should be able to set

    $wgVirtualRestConfig['modules']['parsoid']['domain']='localhost';
    

    But that results in a 404, instead of a timeout.

    In the end, I added my domain name to /etc/hosts and pointed it to 127.0.0.1 and that works fine. It feels like a hack, and I must use a domain name, not just an iP.


  2. We’ve run into this problem several times.

    In one case, it was a matter of access control.

    Parsoid makes HTTP requests to the MediaWiki site. We’re restricting access to certain actions using the Lockdown extension,
    and we had to exempt Parsoid, which can be done in several ways, e.g.:

    if (($_SERVER['REMOTE_ADDR'] !== '127.0.0.1') && ($_SERVER['REMOTE_ADDR'] !== $_
    SERVER['SERVER_ADDR'])) {
    # don't lock down any pages for Parsoid, or the VisualEditor will break on them
        wfLoadExtension('Lockdown');
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search