Topic on Project:Support desk

Error contacting the Parsoid/RESTBase server: http-bad-status in Closed Wikis

This topic was hidden by MarkAHershberger
Reason: Keep people from posting on an old topic
33
89.26.47.65 (talkcontribs)

Is there any way to get VisualEditor working in a closed 1.35 Wiki (Account required for read access)?

Maybe there is a way to force VisualEditor to use a certain Useraccount?

MarkAHershberger (talkcontribs)
89.26.47.65 (talkcontribs)

Thanks for the reply.


i tried to understand that documentation, which is really difficult for a newbie


I have added to the end of my LocalSettings.php :

$PARSOID_INSTALL_DIR = 'vendor/wikimedia/parsoid';

$wfLoadExtension( 'Parsoid', "$PARSOID_INSTALL_DIR/extension.json" );

$wgVisualEditorParsoidAutoConfig = false;

$wgParsoidSettings = [

   'useSelser' => true,

   'rtTestMode' => false,

   'linting' => false,

];

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

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


Now the wiki stopped responding completly (only serves a white page with no HTML at all)

MarkAHershberger (talkcontribs)

Blank or white pages are the first item on Common errors and symptoms.

In any case, your problem is the like that begins $wfLoadExtension. You should not have a $. It should read simply wfLoadExtension.

89.26.47.65 (talkcontribs)

Thanks for your patience


I corrected the line wfLoadExtension( 'Parsoid', "$PARSOID_INSTALL_DIR/extension.json" ); and enabled the printing of fatal php errors. (thanks for the tip)


Sadly trying to edit pages with visual editor still returns the same error message. Creating a new page works fine.

89.26.47.65 (talkcontribs)

Additon: the troubleshooting for VisualEditor also recommendended giving the server read-access with the following code in LocalSettings


if ( $_SERVER['REMOTE_ADDR'] == '127.0.0.1' ) { (note: I also tested this line with the server IP and server IP + port)

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

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

}

But the error message doesnt change.

2003:C9:9F19:B900:20D:B9FF:FE49:6549 (talkcontribs)

"Error contacting the Parsoid/RESTBase server: (curl error: 60) SSL peer certificate or SSH remote key was not OK" from here. Private Network and secure http connection. VisualEditor do not work.

MarkAHershberger (talkcontribs)
Error contacting the Parsoid/RESTBase server: (curl error: 60) SSL peer certificate or SSH remote key was not OK

I'm confused about "SSH remote key" but it looks like you're using a self-signed or otherwise un-recognized cert.

Try the following:

$wgVirtualRestConfig['modules']['parsoid'] = array(
    'url' => 'http://127.0.0.1' . $wgScriptPath . '/rest.php',
);
89.26.47.65 (talkcontribs)

Even with this added to the localsettings.php still the same error message.

MarkAHershberger (talkcontribs)

What is the error message you're getting?

What happens is you remove these lines

$PARSOID_INSTALL_DIR = 'vendor/wikimedia/parsoid';
$wfLoadExtension( 'Parsoid', "$PARSOID_INSTALL_DIR/extension.json" );
$wgVisualEditorParsoidAutoConfig = false;
$wgParsoidSettings = [
   'useSelser' => true,
   'rtTestMode' => false,
   'linting' => false,
];
$wgVirtualRestConfig['modules']['parsoid'] = [];

but keep this one:


$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;
89.26.47.65 (talkcontribs)

Thank you so much for replying.


Error contacting the Parsoid/RESTBase server: http-bad-status


That is the complete error message.


Right now this is all the options set for Visual Editor.


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

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

50.73.98.161 (talkcontribs)

Were you able to resolve your issue? I'm having the same problem

MarkAHershberger (talkcontribs)

Can you see any references to rest.php in your wiki's access logs?

TreiberO (talkcontribs)

I added the following to the LocalSettings

$wgDebugLogFile = "C:\Apache24\htdocs\mediawiki_IT\debug-{$wgDBname}.log";

TreiberO (talkcontribs)

had to use pastebin beacuse posting this was deemed harmful because of "linkspam".

I am sorry

pastbin ID: NHrwFqCZ

MarkAHershberger (talkcontribs)
TreiberO (talkcontribs)

The Message i get is:

"The requested relative path (/192.168.2.73/v3/page/html/Hauptseite/42) did not match any known handler"

404 - "not found".

MarkAHershberger (talkcontribs)
89.26.47.65 (talkcontribs)

I get the exact same message


404 - Did not match any known handler.

MarkAHershberger (talkcontribs)

I don't know enough to help you further. Could you post a task to Phabricator pointing back here?

89.26.47.65 (talkcontribs)

Thank you for all your help,

I will do that.

Sorry for the late replies.

MarkAHershberger (talkcontribs)

I should have asked you to post the task # here, as well.

109.208.148.21 (talkcontribs)

Hi,

I get exactly the same issue, i was following this topic...

Can you give me the Phabricator's URL where i can follow your issue?

Thx

109.208.148.21 (talkcontribs)

Sorry but i just found for my issue.

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

if ( !isset( $_SERVER['REMOTE_ADDR'] ) OR $_SERVER['REMOTE_ADDR'] == '127.0.0.1>

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

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

}

Order is important !!!

37.201.6.225 (talkcontribs)

109.208.148.21's code snippet didn't work for me, I had to alter it a bit because in my environment, the server used it's actual IP instead of localhost. Here's a snippet for your LocalSettings.php that _might_ just work on a couple systems more because it covers both cases:


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

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

if (in_array($_SERVER['REMOTE_ADDR'],

   [

       $_SERVER['SERVER_ADDR'],

       '127.0.0.1',

       'localhost',]

)) {

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

   $wgGroupPermissions['*']['write'] = true;

}


Hope the time I had to invest in this saves some of someone else's time in the future.

37.201.6.225 (talkcontribs)

Please note that above solution is not ideal for wikis with sensible data, someone with restricted access to your server will be able to access the entire wiki. If you're on a shared hoster, you won't have control over that. The only sensible option is to wait until this "LTS" version is in an actually usable state, or to install parsoid by yourself.

Blake.Milam (talkcontribs)

I had this error message and I was able to correct it by changing the server path to not use https. In LocalSettings under "## The protocol and server name to use in fully-qualified URLs" I had fat-fingered an https into the link

85.237.51.12 (talkcontribs)

Yet another line should be added in Parsoid permission condition for private MediaWiki-s behind reverse proxy:

if (in_array($_SERVER['REMOTE_ADDR'],

  [

       $_SERVER['SERVER_ADDR'],

       $_SERVER['HTTP_X_FORWARDED_FOR'], # if MediaWiki behind reverse proxy

       '127.0.0.1',

       'localhost',]

)) {

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

  $wgGroupPermissions['*']['write'] = true;

}

Squeak24 (talkcontribs)

Did anyone get this working?


I am on a private server running Windows Server 2012 (I know!). But just can't seem to get it working. I am trying to move to Linux, but that's still work in progress.


Any help is appreciated

Wolfcu69 (talkcontribs)

I am having the same issue with version 1.37.1.

Compumatter (talkcontribs)

Using NGINX - Error contacting the Parsoid/RESTBase server (HTTP 400)

SOLVED - no custom changes needed on LocalSettings other than:

wfLoadExtension( 'VisualEditor' );

However, I discovered on this page my solution: https://www.mediawiki.org/wiki/Parsoid#Linking_a_developer_checkout_of_Parsoid

I edited my nginx virtual host file for the domain my wiki is being served under ie;

  • /etc/nginx/site-available/domainname

Then insert this as an additional location block location /rest.php/ for instance in my case:

server { ...

 index index.php index.html index.htm;
 location / {
   try_files $uri $uri/ /index.php;
 }
 location ~ \.php$ {
   fastcgi_pass unix:/run/php/php7.4-fpm.sock;
   include snippets/fastcgi-php.conf;
 }
 location /rest.php/ {
   try_files $uri $uri/ /rest.php?$query_string;
 }




}

109.252.172.78 (talkcontribs)

Nothing work from described here.

Mediawiki installed in intranet with local IPs on apache 2.4 without ssl. Gateway to internet have NAT and reverse proxy apache 2.4 mod_proxy + mod_ssl. Users work via https.

$_SERVER['REMOTE_ADDR'] == internal/local IP of router/reverse proxy

$_SERVER['HTTP_X_FORWARDED_FOR'] == client IP

$_SERVER['SERVER_ADDR'] == local IP of mediawiki host


If I login or logout - nothing changed. All variables have always same values.

Tried "ProxyPreserveHost On" and "AllowEncodedSlashes NoDecode" - nothing changed: "Error contacting the Parsoid/RESTBase server: http-bad-status".

MarkAHershberger (talkcontribs)

Please open a new support request instead of adding to this one.