Page MenuHomePhabricator

VisualEditor does not load page content: "The requested relative path (/v1/page/html/Main_Page) did not match any known handler"
Closed, ResolvedPublicBUG REPORT

Description

I am using MediaWiki 1.35. VisualEditor is not showing page content. Instead, all pages are displayed as empty when trying to edit them.

Checking the console I realized that it is trying to access non existing URLs. For example, VisualEditor is trying to access this URL:

https://www.example.org/wiki/rest.php/v1/page/html/Main_Page?redirect=false&stash=true

which returns an error 404 with "The requested relative path (/v1/page/html/Main_Page) did not match any known handler".

However, with some guessing I found that at

https://www.example.org/wiki/rest.php/v1/page/Main_Page?redirect=false&stash=true

the page content would be returned.

But this URL is not being called. Seems like the configuration is somehow wrong.

This is set in LocalSettings.php:

# The wiki is at in a subfolder called wiki.
$wgScriptPath = '/wiki';
wfLoadExtension( 'VisualEditor' );
$wgVisualEditorFullRestbaseURL = $wgServer . $wgScriptPath . '/rest.php/';
$wgVirtualRestConfig['modules']['parsoid'] = array(
    'url' => $wgServer . $wgScriptPath . '/rest.php',
);
$wgVisualEditorRestbaseURL = $wgServer . $wgScriptPath . '/rest.php/v1/page/html/';

What needs to be changed to fix that?

Event Timeline

Note that I see this error as well on a fresh install of 1.35.0. VE worked in the previous RC for 1.35.0 that I tried.

Hmmm.... after testing this morning, let me clarify that using the LocalSettings.php that MW generates works, but doing something very similar with my own LocalSettings.php does not work and I'm not sure what the difference is.

Let me add a few aspects. Each one of these first had to be configured correctly - before that, each single one produced an error for me:

  • Parsoid has to be installed.
  • Parsoid configuration in $wgVirtualRestConfig['modules']['parsoid'] has to be made in a way so that the URL to the Parsoid instance is pointing to rest.php.
  • The Restbase URL for VisualEditor has to be configured to point to the rest.php file as well. (I am seeing other things in examples on mediawiki.org, but these are not working for me. Maybe they assume there are some rewrites in place in the server config?)
  • The write API has to be enabled.

I am still not sure, what the difference is between $wgVisualEditorRestbaseURL and $wgVisualEditorFullRestbaseURL.

@Joergi123 can you confirm that VE works for you after you've made these changes? Can you tell us what specific lines you added or changed? From your description, it sounds like the following:

wfLoadExtension( 'Parsoid' );
$wgVirtualRestConfig['modules']['parsoid']['url'] = "..../rest.php";
$wgVirtualRestConfig['modules']['restbase']['url'] = "..../rest.php";
$wgGroupPermissions['user']['writeapi'] = true;
  • Parsoid has to be installed.

This should happen automatically when VisualEditor is installed from the tarball or the REL1_35 branch in git.

How did you install it?

I have installed MediaWiki using the tarball.

I have now added the following lines to LocalSettings.php:

wfLoadExtension( 'VisualEditor' );

$wgGroupPermissions['user']['writeapi'] = true;

As long as $wgVirtualRestConfig['modules']['parsoid'] is not set in LocalSettings.php, Parsoid will be activated automatically. In this case, there is no need to load it manually.

I have not configured anything special for Parsoid or Restbase.

(I now have also removed $wgVisualEditorRestbaseURL, wich I had set before. It seems to be working now, which is strange as this should more or less be exactly the config I once started with and which did not work back then...)