Topic on Extension talk:VisualEditor

Error contacting the Parsoid/RESTBase server (HTTP 415)

11
Summary last edited by Urfiner 18:05, 8 October 2020 1 year ago

Had the same error.

I have a redirect from http to https in apache. Apache does not pass headers on redirect (because a client should do it)

Also, I had

$wgServer           = "//brainstorage.amust.local";

Because of that http was used as a protocol for Parsoid.

I've changed it to:

$wgServer           = "https://brainstorage.amust.local";

Now everything works

85.255.235.204 (talkcontribs)

just installed 1.35 on a brand new server, I am getting:


"Something went wrong

Error contacting the Parsoid/RESTBase server (HTTP 415)"


Haven't seen any troubleshooting regarding an HTTP 415 error, does anyone have any pointers where I could look or try?


Thank you

85.255.235.204 (talkcontribs)

This is the response I get


{"message":"A Content-Type header must be supplied with a request payload.","error":"no-content-type","httpCode":415,"httpReason":"Unsupported Media Type"}


and the trace


#0 /var/www/html/w/extensions/VisualEditor/includes/ApiParsoidTrait.php(279): ApiVisualEditorEdit->requestRestbase(Object(Title), 'POST', 'transform/html/...', Array, Array)

#1 /var/www/html/w/extensions/VisualEditor/includes/ApiParsoidTrait.php(296): ApiVisualEditorEdit->postData('transform/html/...', Object(Title), Array, Array, NULL)

#2 /var/www/html/w/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(189): ApiVisualEditorEdit->postHTML(Object(Title), '<!doctype html>...', Array, NULL)

#3 /var/www/html/w/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(163): ApiVisualEditorEdit->getWikitextNoCache(Object(Title), Array, Array)

#4 /var/www/html/w/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(349): ApiVisualEditorEdit->getWikitext(Object(Title), Array, Array)

#5 /var/www/html/w/includes/api/ApiMain.php(1593): ApiVisualEditorEdit->execute()

#6 /var/www/html/w/includes/api/ApiMain.php(529): ApiMain->executeAction()

#7 /var/www/html/w/includes/api/ApiMain.php(500): ApiMain->executeActionWithErrorHandling()

#8 /var/www/html/w/api.php(90): ApiMain->execute()

#9 /var/www/html/w/api.php(45): wfApiMain()

#10 {main}

Edmond Media (talkcontribs)

and this is the request


[method] => POST [url] => /restbase/local/v1/transform/html/to/wikitext/TestingPage [body] => ([html] => <!doctype html><html><head><base href="https://en.wikipedia.org/w/"><base href="https://en.wikipedia.org/w/"></head><body><p>Test Text for Test PAGE</p></body></html> [scrub_wikitext] => 1 ) [headers] => ([If-Match] => [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.0-rc.3 [Api-User-Agent] => VisualEditor-MediaWiki/1.35.0-rc.3 )

Edmond Media (talkcontribs)

on the previous message it should say myWebsite instead of en.wikipedia.org (the spam filter was blocking it when I had my website there)

Edmond Media (talkcontribs)

The exact same setup works on my local machine when running with localhost. Same OS, Debian 10.6. Same packages. The only difference is that this error is when deploying on the AWS cloud.


Could it have anything to do with the base ref having to be localhost on the POST message?

Could it be that it should be http and not https, my EC2 instances only have port 80 open, I believe the load balancer forwards http to the EC2 instances?

Tstout21 (talkcontribs)

This appears to be related to HTTPS. When I use http I can save using VisualEditor. I get the error only when using SSL.

85.255.235.204 (talkcontribs)

Thanks Tstout21


I tied hacking the file /var/www/html/w/extensions/VisualEditor/includes/ApiParsoidTrait.php with the following:

$request['body']['html'] = '<!doctype html><html><head><base href="localhost/w/"><base href="localhost/w/"></head><body><p>Test Text for Test PAGE</p></body></html>';


also tried using http + localhost and http + mywebsite but none worked...

Edmond Media (talkcontribs)

I reinstalled MediaWiki and it works now....

Corruptedxcomics (talkcontribs)

Same issue on 1.36.1 of mediawiki. Tried reinstalling it and it does not work.

138.188.55.41 (talkcontribs)

For me the problem was in the LocalSettings.php file. The URL path of the installation was there without http. I changed it to https. Now it works.

Perohanych (talkcontribs)

I have fixed the error by changing http: to https: in the LocalSetting.php file.

Thanks to 138.188.55.41 !

Reply to "Error contacting the Parsoid/RESTBase server (HTTP 415)"