User:Andrujhon/Allow Parsoid Server

This is long outdated information from when Parsoid was a separate NodeJS app. I'm leaving it here for the odd person who might still need to set up an old version, but if you're setting up anything beyond MediaWiki 1.35 this is not relevant. Andru - 2025-02-08

If you're running a private wiki and don't want to enable cookie forwarding for Parsoid, you can explicitly remove read/edit restrictions in your "LocalSettings.php" file for Parsoid by checking the remote IP address.

Place this code after all other permission related config. Change 127.0.0.1 to the IP of the server on which Parsoid is running, if your wiki and Parsoid do not share the same server.

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

In case you are getting PHP notices from cron like e.g. "PHP Notice: Undefined index: REMOTE_ADDR in /path/to/wiki/LocalSettings.php on line ..." use the following:

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