Topic on Extension talk:VisualEditor

(curl error: 7) Couldn't connect to server

5
Weinberg1992 (talkcontribs)

Setting up Visual Editor for a private wiki, but keep getting errors as stated in the topic, when I hit edit on pages. How can I fix this problem?


Settings in Localhost.php

# Disable reading by anonymous users

$wgGroupPermissions['*']['read'] = false;

# Disable anonymous editing

$wgGroupPermissions['*']['edit'] = false;

# Prevent new user registrations except by sysops

$wgGroupPermissions['*']['createaccount'] = false;

# Linking with Parsoid

$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;

$wgVirtualRestConfig['modules']['parsoid'] = array(

    // URL to the Parsoid instance

    // Use port 8142 if you use the Debian package

    'url' => 'server's ip address:8000',

    // Parsoid "domain", see below (optional)

    'domain' => 'localhost',

    // Parsoid "prefix", see below (optional)

    'prefix' => 'localhost'

);

# Basic configuration for MediaWiki-VisualEditor

wfLoadExtension( 'VisualEditor' );

// Enable by default for everybody

$wgDefaultUserOptions['visualeditor-enable'] = 1;

// Optional: Set VisualEditor as the default for anonymous users

// otherwise they will have to switch to VE

// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";

// Don't allow users to disable it

$wgHiddenPrefs[] = 'visualeditor-enable';

// OPTIONAL: Enable VisualEditor's experimental code features

#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;


Settings in config.yaml

services:

  - module: lib/index.js

    entrypoint: apiServiceWorker

    conf:

        # For backwards compatibility, and to continue to support non-static

        # configs for the time being, optionally provide a path to a

        # localsettings.js file.  See localsettings.example.js

        #localsettings: ./localsettings.js

        # Set your own user-agent string

        # Otherwise, defaults to:

        #   'Parsoid/<current-version-defined-in-package.json>'

        #userAgent: 'My-User-Agent-String'

        # Configure Parsoid to point to your MediaWiki instances.

        mwApis:

        - # This is the only required parameter,

          # the URL of you MediaWiki API endpoint.

          uri: 'server's IP address/wiki/api.php'

          # The "domain" is used for communication with Visual Editor

          # and RESTBase.  It defaults to the hostname portion of

          # the `uri` property above, but you can manually set it

          # to an arbitrary string. It must match the "domain" set

          # in $wgVirtualRestConfig.

          domain: 'localhost'  # optional

          # To specify a proxy (or proxy headers) specific to this prefix

          # (which overrides defaultAPIProxyURI). Alternatively, set `proxy`

          # to `null` to override and force no proxying when a default proxy

          # has been set.

Rrosenfeld (talkcontribs)

I got this running by using the following work around:

if ( !isset( $_SERVER['REMOTE_ADDR'] ) OR $_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
    $wgGroupPermissions['*']['read'] = true;
    $wgGroupPermissions['*']['edit'] = true;
}

And using uri: 'http://localhost/api.php' in config.yaml.

In addition I added an apache site on localhost:80, which only allows access from 127.0.0.1 without SSL, since parsoid doesn't support SSL and I don't like the workaround with stunnel.

This setup seems to work without problems for two weeks in our production setup now.

Yrwyddfa (talkcontribs)

Hi Rrosenfeld,

thanks for that workaround! But, to be honest, I have no idea how to realize the second part of your suggestion. How did you manage to add localhost:80 with 127.0.0.1 without SSL in apache? Could you share the configuration? That really would be appreciating!


Thanks a lot in advance!


YW

Rrosenfeld (talkcontribs)
<VirtualHost localhost:80>
        ServerName localhost
        DocumentRoot /srv/www/wiki/htdocs

        ErrorLog ${APACHE_LOG_DIR}/localhost80.error.log
        CustomLog ${APACHE_LOG_DIR}/localhost80.access.log combined

        <Directory />
                Options None
                AllowOverride None
                Require all denied
        </Directory>

        <Directory /srv/www/wiki>
                Options FollowSymLinks
                AllowOverride All
                Require ip 127.0.0.1
        </Directory>
</VirtualHost>

should do the job.

Yrwyddfa (talkcontribs)

Thanks a lot! Maybe some others will benefit, unfortunately it didn't solve my issue. It seems that a bunch of many, many different problems can lead to the error above. Guess I'll have to dig deeper and hopefully find the problem which causes my troubles. That really is kind of frustrating.

Reply to "(curl error: 7) Couldn't connect to server"