Page MenuHomePhabricator

VisualeEditor: Error contacting the Parsoid/RESTBase server (HTTP 404)
Open, Needs TriagePublic

Description

Setup

  • MW 1.35
  • VisualEditor REL_1_35

Issue
If one wants to use VisualEditor with a short URL like e.g. https://wiki.example.org/Main_Page you will get "Error contacting the Parsoid/RESTBase server (HTTP 404)" Once you add an URL particle (not sure how to call it) like page as in e.g. https://wiki.example.org/page/Main_Page everything works as expected. Thus it appears that currently having this URL particle is required.

works for https://wiki.example.org/page/Main_Page

<IfModule mod_rewrite.c>
        RewriteEngine on

        RewriteRule ^/?page(/.*)?$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
        RewriteRule ^/?$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
</IfModule>

does not work https://wiki.example.org/Main_Page

<IfModule mod_rewrite.c>
        RewriteEngine on

        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
        RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
</IfModule>

Perhaps some extra voodoo is to be added to the rewrite rules to also make something like https://wiki.example.org/Main_Page possible but I do not know what it could be.

Created this report to make you aware however I suspect that this may be a dupe already.

Event Timeline

Kghbln updated the task description. (Show Details)

I'm also having this issue. I've tried the troubleshooting steps provided on the extension page, but to no avail. I think my wiki is a private wiki...don't know if that has anything to do with the issue.

I did some snooping on my end; had a fresh install of Mediawiki 1.35.1 ready to go. Visual Editor works right out the box, but as you said, the second you shorten the link, everything breaks and we get a 404. I found that editing my .htaccess file didn't do anything, but the second I added

$wgScriptExtension = ".php";
$wgArticlePath = "/$1";

everything broke. I don't know what we're missing...

@Orribu Thanks for confirming that you have this issue too. $wgArticlePath is fine for this kind of short URLs. PS You can safely remove $wgScriptExtension since this parameter does no longer exist since MW 1.27 or so.

@kghlbn Thank you for the follow-up and the tip! I've removed $wgScriptExtension from LocalSettings.
I'll keep an eye on this space for any updates!

The redwerks tool mentioned on Manual:Short URL page still instructs users to set $wgScriptExtension = ".php"; even though it can detect MW version (instructed me to add also for 1.35.0 so I'm betting a lot of users end up with that line or maybe some other outdated stuff)? Thanks for mentioning.

Same issue as well, though I tried adding the block you had above but didn't work for me.

I had to abandon the rest of the short URL instructions on the Manual:Short URL, and just do the default Short URL Simple Instructions (default MW structure and URL setup behavior--for Apache, not use the redwerks tool, ignore the rest of the Manual:Short URL page and then create the necessary rewrites based on tips from our host docs since the rewrite rules provided there didn't work for us either. Only the following would work (I'm not good at rewrites, I'm sure this is NOT the correct way to do this, it was just the only thing that worked on our setup since I'm NOT good at this part--if anyone knows a better way to do this please let me know, thanks).

I had to put in LocalSettings.php:

$wgScriptPath = "/w"; # Folder MW is installed in on server
$wgArticlePath = "/wiki/$1"; # URL path shown in browser (only /wiki/ would work)

And in .htaccess (at root web level, not in the w folder):

RewriteEngine on
RewriteBase /

# Rewrites all URLS without w in them
RewriteCond %{REQUEST_URI} !^/w/

# Rewrites all URLS [Replace "example-sitename" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?example-sitename\.

# Rewrite all those to w /folder
RewriteRule ^(.*)$ /w/$1 [L]

I hope there's a fix for this soon. Thanks for making the ticket!