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 https://phabricator.wikimedia.org/T249997 .
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/wiki.sciences.re/v3/page/html/Main_Page/1?redirect=false&stash=true 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 https://github.com/wikimedia/mediawiki/blob/master/includes/api/ApiMain.php#L1467 or https://github.com/wikimedia/mediawiki/blob/master/includes/WebStart.php#L94.
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 E..."S@.@..............a.<.....K........... h.'.h.'.GET /api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en&formatversion=2 HTTP/1.0 Host: wiki.sciences.re X-Real-IP: 91.86.53.70 X-Forwarded-For: 91.86.53.70 X-Forwarded-Proto: https X-Forwarded-Host: wiki.sciences.re X-Forwarded-Server: wiki.sciences.re 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 referer: https://wiki.sciences.re/index.php?title=Main_Page&veaction=edit 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 E..n..@.@.y............a..*..........c..... h.(Vh.(VGET /rest.php/wiki.sciences.re/v3/page/html/Main_Page/1?redirect=false&stash=true HTTP/1.0 Host: wiki.sciences.re X-Real-IP: 2001:bc8:47b0:2640::1 X-Forwarded-For: 2001:bc8:47b0:2640::1 X-Forwarded-Proto: https X-Forwarded-Host: wiki.sciences.re X-Forwarded-Server: wiki.sciences.re Connection: close Content-Length: 0 accept: text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/2.0.0" 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 E..!..@.@.L8.........a........,Q........... 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> <html> <head><meta charset="UTF-8" /></head> <body> The 'Promise-Non-Write-API-Action' HTTP header was sent but the request was to an API write module. </body> </html> 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 E..^d!@.@..v.........a.....K.<.O.....S..... 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 https://wiki.sciences.re/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."}}