1

I'm having a strange issue here. I have a site running Craft 3.3.7. I have an entry with a matrix field with several redactor fields in it. In one of those redactor fields, I have a paragraph of text. I can save the entry fine, until I try to add a hyperlink (either via the button or adding it in the html editor) at which point I get a Bad Request: Post Request Required error.

I can add hyper links to the other redactor blocks on the entry and to other entries on the site. I tried simply adding a new block and moving the text to there but I get the same error.

I can save the paragraph without the link, so there doesn't seem to be a strange character throwing it off. And it has nothing to do with the href destination as I tried several and even left it empty and received the error every time.

I found an issue in the Redactor github that looks similar that was related to the HTML Purifier, but that it is switched off for this field.

I've checked with server support and there are no relevant errors displaying on that end.

I've checked the craft error logs and it looks like adding the hyper link is causing the attempt to save to come through as an empty post request, thus the error. Unsure why that is.

2019-12-06 17:38:24 [-][12172][ql7adqo20ana0h4he9iiv3iv30][error][yii\web\HttpException:400] yii\web\BadRequestHttpException: Post request required in /home/[sitename]/vendor/craftcms/cms/src/web/Controller.php:333
Stack trace:
#0 /home/[sitename]/vendor/craftcms/cms/src/controllers/EntriesController.php(311): craft\web\Controller->requirePostRequest()
#1 [internal function]: craft\controllers\EntriesController->actionSaveEntry(false)
#2 /home/[sitename]/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#3 /home/[sitename]/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#4 /home/[sitename]/vendor/craftcms/cms/src/web/Controller.php(187): yii\base\Controller->runAction('save-entry', Array)
#5 /home/[sitename]/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-entry', Array)
#6 /home/[sitename]/vendor/craftcms/cms/src/web/Application.php(299): yii\base\Module->runAction('entries/save-en...', Array)
#7 /home/[sitename]/vendor/craftcms/cms/src/web/Application.php(566): craft\web\Application->runAction('entries/save-en...', Array)
#8 /home/[sitename]/vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#9 /home/[sitename]/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#10 /home/[sitename]/html/index.php(21): yii\base\Application->run()
#11 {main}
2019-12-06 17:38:24 [-][12172][ql7adqo20ana0h4he9iiv3iv30][info][application] $_GET = [
    'p' => '500.shtml'
]

$_POST = []

$_FILES = []
0

From 'p' => '500.shtml' it looks like your server is configured to redirect to a 500.shtml file whenever it encounters an error, which is probably confusing Craft routing and obscuring the real error message.

I'd check to see if you have Suhosin or ModSecurity installed on the server as it's possible the link you're trying to add it tripping up one of their rules.

| improve this answer | |
  • ModSecurity is installed. I tried to recreate the entry with the same content and add the link and ModSecurity interpreted that attempt as a SQL injection and temporarily blacklisted my IP. What Isn't clear to me is why adding a link here would be tripping it up. The content of the link does not seem to matter and even attempting to add an anchor to the redactor with a blank href is causing this issue, but only on this entry. – Josh Parylak Dec 9 '19 at 12:53
  • ¯_(ツ)_/¯ - I've only had headaches with ModSecurity. – Brad Bell Dec 9 '19 at 16:43
  • This was exactly it, they were able to whitelist the rule for the admin to get us running again. Thanks Brad. – Josh Parylak Dec 9 '19 at 20:07
  • Glad to hear!!! – Brad Bell Dec 10 '19 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.