Page MenuHomePhabricator

Error contacting the Parsoid/RESTBase server (HTTP 400)
Open, Needs TriagePublic


Hi everyone.
I'm using nginx as a proxy (for tls termination) for my mediawiki 1.35 installation, which itself runs on apache. I have trouble making the Visual Editor working, right now I cannot use it to interact with the wiki. The non-visual editor works as expected. Please note this might be related to .

From the Visual Editor UX, the error message I get is the following, whenever I click on "edit this page":

Error contacting the Parsoid/RESTBase server (HTTP 400)

Checking what happens, it seems that Mediawiki is making a GET request to itself on the /rest.php/ path, request which fails because the promise-non-write-api-action: true header is present, which results in a 400 http code with the following message:

The 'Promise-Non-Write-API-Action' HTTP header was sent but the request was to an API write module.

This might be related to or

Such a message is "hidden", and I only saw it using tcpdump to check the requests between the nginx frontend and the apache "backend".

I'm wondering if this is a mistake in my configuration, or a bug elsewhere.

Here are the detailed "tcpdump" logs:

08:27:45.252115 IP localhost.40468 > localhost.cbt: Flags [P.], seq 2218589125:2218589775, ack 3078592587, win 512, options [nop,nop,TS val 1757161229 ecr 1757161229], length 650
h.'.h.'.GET /api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en&formatversion=2 HTTP/1.0
X-Forwarded-Proto: https
Connection: close
user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0
accept: application/json, text/javascript, */*; q=0.01
accept-language: en-US,en;q=0.5
x-requested-with: XMLHttpRequest
cookie: mediawikiUserName=Remy.grunblatt; VEE=visualeditor

08:27:45.581493 IP localhost.40472 > localhost.cbt: Flags [P.], seq 4276759063:4276759633, ack 3399028897, win 512, options [nop,nop,TS val 1757161558 ecr 1757161558], length 570
h.(Vh.(VGET /rest.php/ HTTP/1.0
X-Real-IP: 2001:bc8:47b0:2640::1
X-Forwarded-For: 2001:bc8:47b0:2640::1
X-Forwarded-Proto: https
Connection: close
Content-Length: 0
accept: text/html; charset=utf-8; profile=""
accept-language: en
user-agent: VisualEditor-MediaWiki/1.35.1
api-user-agent: VisualEditor-MediaWiki/1.35.1
promise-non-write-api-action: true

08:27:45.871029 IP localhost.cbt > localhost.40472: Flags [P.], seq 1:494, ack 570, win 512, options [nop,nop,TS val 1757161848 ecr 1757161558], length 493
h.)xh.(VHTTP/1.1 400 Bad Request
Date: Thu, 01 Apr 2021 08:27:45 GMT
Server: Apache/2.4.46 (Unix)
X-Powered-By: PHP/7.3.23
X-Content-Type-Options: nosniff
Cache-Control: no-cache
X-Request-Id: b3bb3d7d393cfe9f73570149
Content-Length: 194
Connection: close
Content-Type: text/html; charset=utf-8

<!DOCTYPE html>
<head><meta charset="UTF-8" /></head>
The &#039;Promise-Non-Write-API-Action&#039; HTTP header was sent but the request was to an API write module.

08:27:45.946722 IP localhost.cbt > localhost.40468: Flags [P.], seq 1:811, ack 650, win 512, options [nop,nop,TS val 1757161924 ecr 1757161229], length 810
h.).h.'.HTTP/1.1 200 OK
Date: Thu, 01 Apr 2021 08:27:45 GMT
Server: Apache/2.4.46 (Unix)
X-Powered-By: PHP/7.3.23
X-Content-Type-Options: nosniff
MediaWiki-API-Error: apierror-visualeditor-docserver-http
X-Frame-Options: DENY
Content-Disposition: inline; filename=api-result.json
Cache-Control: private, must-revalidate, max-age=0
X-Request-Id: 6d607b6d8417b862f3356726
Connection: close
Content-Type: application/json; charset=utf-8

{"error":{"code":"apierror-visualeditor-docserver-http","info":"Error contacting the Parsoid/RESTBase server (HTTP 400)","docref":"See for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;; for notice of API deprecations and breaking changes."}}

Event Timeline

It seems that you have incompatible versions of VisualEditor and MediaWiki – this error would occur if your VisualEditor included this patch:, but your MediaWiki did not include this patch:

Can you try re-installing both from the same source? (either the tarball, or the Git branches)


This was indeed the problem ! I feel my mistake might be a very classical mistake: I went straight for the download link (my bad), which brought me to and I saw "1.35 (latest stable mediawiki)" and thought that was ok since I was also using 1.35.1.

I'm glad you got it working. I think we can close this task now.

(And thanks for the details in the report, this should help anyone who runs into the same problem in the future.)

We should make VisualEditor REL1_35 require MediaWiki 1.35.2 now that it's been released, I'll submit a patch.

Change 680134 had a related patch set uploaded (by Legoktm; author: Legoktm):

[mediawiki/extensions/VisualEditor@REL1_35] Require MediaWiki >= 1.35.2

Change 680134 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@REL1_35] Require MediaWiki >= 1.35.2

I reopen the issue because I'm facing exactly the same behavior with MediaWiki 1.35.2 (installed from tar.gz, not git), also behind nginx proxy. I can also read from tcpdump:

The &#039;Promise-Non-Write-API-Action&#039; HTTP header was sent but the request was to an API write module.

How can I help (my knowledge with programming is limited though)?

Hi just wanted to say thanks for this issue/thread and solution! I did all the debugging you did as well (finding Promise-Non-Write-API-Action) and I'd never have guessed that it was a version mismatch between VE and MW, no idea how that happened, but fully upgrading to MW 1.35.2 fixed it! Cheers!

@CharlesNepote just saying it works for me with that version on nginx. Are you sure you're using the VE version shipped with MW?