Page MenuHomePhabricator

Parsoid, VisualEditor not working with SSL / HTTPS
Closed, InvalidPublic0 Estimated Story Points

Description

My LocalSettings.php

wfLoadExtension( 'VisualEditor' );
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
$wgHiddenPrefs[] = 'visualeditor-enable';

#$wgVirtualRestConfig['modules']['parsoid']['url'] = "https://wiki.dronelaws.io:8000";
$wgVirtualRestConfig['modules']['parsoid']['url'] = "http://localhost:8142";
#$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;

my nginx site config

server {
    listen 80;
    listen [::]:80;
    server_name wiki.dronelaws.io;
    return 301 https://$server_name$request_uri;

    location ~ /.well-known {
        allow all;
    }

}

server {
    listen 8000 ssl http2;
    listen [::]:8000 ssl http2;
    charset utf-8;

    ssl_certificate /etc/letsencrypt/live/wiki.dronelaws.io/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/wiki.dronelaws.io/privkey.pem;

    include snippets/ssl-params.conf;

    location / {
        proxy_pass http://127.0.0.1:8142;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }


}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    charset utf-8;

    ssl_certificate /etc/letsencrypt/live/wiki.dronelaws.io/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/wiki.dronelaws.io/privkey.pem;

    include snippets/ssl-params.conf;

    root /var/www/dronelaws/wiki/html;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name wiki.dronelaws.io;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }

    location ~ /.well-known {
        allow all;
    }

}

I keep getting 404 errors. You can see from one of my server blocks I attempt to proxy port 8000 to localhost 8142 with SSL, still no go.

Any help would be appreciated.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This appears to be the response / request and it's accompanying error

https://wiki.dronelaws.io/api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en

{"error":{"code":"apierror-visualeditor-docserver-http","info":"HTTP 404","*":"See https://wiki.dronelaws.io/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."}}

This appears to be the response / request and it's accompanying error

https://wiki.dronelaws.io/api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en

{"error":{"code":"apierror-visualeditor-docserver-http","info":"HTTP 404","*":"See https://wiki.dronelaws.io/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."}}

That isn't the error I get.

{"error":{"code":"unknown_action","info":"Unrecognized value for parameter \"action\": visualeditor.","*":"See https://wiki.dronelaws.io/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."}}

Have you tried looking at the Parsoid troubleshooting page?

@Deskana I had plugin temporarily disabled so people didn't try to use it. Try now.

@Deskana I had plugin temporarily disabled so people didn't try to use it. Try now.

Yeah, I see it now. Sadly, the only advice I can offer is to try the Parsoid troubleshooting page.

What does your Parsoid config.yaml look like?

@Arlolra

/etc/mediawiki/parsoid$ cat config.yaml
# This is a sample configuration file
#
# Also see:
# - `npm start -- -h` for more information about passing config files via
#   the commandline.
# - lib/config/ParsoidConfig.js for all the properties that you can configure
#   here. Not all properties are documented here.

worker_heartbeat_timeout: 300000

logging:
    level: info

#metrics:
#    type: log

services:
  - module: ../src/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: 'https://wiki.dronelaws.io/api.php'
          # The "domain" is used for communication with Visual Editor
          # and RESTBase.  It defaults to the hostname portion of
          # the `uri` property below, but you can manually set it
          # to an arbitrary string.
          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.
          #proxy:
          #    uri: 'http://my.proxy:1234/'
          #    headers:  # optional
          #        'X-Forwarded-Proto': 'https'

        # We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly
        # for other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks',
        # 'enwikivoyage' etc.
        # The default for this is false. Uncomment the line below if you want
        # to load WMF's config for wikipedias, etc.
        #loadWMF: true

        # A default proxy to connect to the API endpoints.
        # Default: undefined (no proxying).
        # Overridden by per-wiki proxy config in setMwApi.
        #defaultAPIProxyURI: 'http://proxy.example.org:8080'

        # Enable debug mode (prints extra debugging messages)
        #debug: true

        # Use the PHP preprocessor to expand templates via the MW API (default t                                                                             rue)
        #usePHPPreProcessor: false

        # Use selective serialization (default false)
        #useSelser: true

        # Allow cross-domain requests to the API (default '*')
        # Sets Access-Control-Allow-Origin header
        # disable:
        #allowCORS: false
        # restrict:
        #allowCORS: 'some.domain.org'

        # Allow override of port/interface:
        #serverPort: 8000
        #serverInterface: '127.0.0.1'

        # Enable linting of some wikitext errors to the log
        #linting: true
        # Send lint errors to MW API instead of to the log
        #linterSendAPI: false

        # Require SSL certificates to be valid (default true)
        # Set to false when using self-signed SSL certificates
        #strictSSL: false

        # Use a different server for CSS style modules.
        # Leaving it undefined (the default) will use the same URI as the MW API                                                                             ,
        # changing api.php for load.php.
        #modulesLoadURI: 'http://example.org/load.php'

Parsoid seems to be configured correctly since https://wiki.dronelaws.io:8000/localhost/v3/page/html/Main_Page/2 renders just fine.

Since nginx is pointing to 127.0.0.1 instead of localhost and that works, let's try being explicit about that as well.

Update your LocalSettings.php to,

$wgVirtualRestConfig['modules']['parsoid'] = array(
	'url' => 'http://127.0.0.1:8142',
	'domain' => 'localhost'
);

@PlanetKrypton: did you try @Arlolra’s config? My rule of thumb about that is: put a domain on both sides or nowhere. But it seems your domain name expired, which kind of more critical than this issue.

Deskana set the point value for this task to 0.Jan 15 2018, 11:51 AM

I close this task given it is a request of support with no response since 5 months and the domain name expired since at least 3 months. Feel free to reopen if needed.