contact-form
contact-form copied to clipboard
Bad Request in Firefox Nightly
In Firefox Nightly, if you have logged into the Craft CP, submitting a message through Contact Form gets the Craft message “Bad Request: Unable to verify your data submission.” Once the Craft cookies (including the login cookies) are deleted, Contact Form submits fine. Please note that the actual cookie at fault might not be one of the CP login trackers. I tried to narrow down the cookie at fault, but had a fair amount of trouble deleting individual cookies.
This has been true for at least the date of this report and the date before, though I don’t believe it was a problem a few weeks earlier. I’m not certain of that last, however.
Here’s the slightly redacted (to remove path information) stack trace from a failed submission attempt:
2018-12-04 06:59:57 [-][-][5458368c30f61f1a7393ea400a2ce655][error][yii\web\HttpException:400] yii\web\BadRequestHttpException: Unable to verify your data submission. in ••••••••••/vendor/yiisoft/yii2/web/Controller.php:166
Stack trace:
#0 ••••••••••/vendor/craftcms/cms/src/web/Controller.php(83): yii\web\Controller->beforeAction(Object(yii\base\InlineAction))
#1 ••••••••••/vendor/yiisoft/yii2/base/Controller.php(155): craft\web\Controller->beforeAction(Object(yii\base\InlineAction))
#2 ••••••••••/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller->runAction('', Array)
#3 ••••••••••/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('', Array)
#4 ••••••••••/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('contact-form/se...', Array)
#5 ••••••••••/vendor/craftcms/cms/src/web/Application.php(542): craft\web\Application->runAction('contact-form/se...', Array)
#6 ••••••••••/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#7 ••••••••••/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#8 ••••••••••/public/index.php(21): yii\base\Application->run()
#9 {main}
I can provide a full error log entry privately, if needed.
@chronicole pointed out to me that this very well may be related to https://github.com/craftcms/cms/issues/3258.
I'm having a similar problem in the latest Chrome. I just updated to Craft 3.1 beta yesterday. I have a form with a {{ csrfInput() }}
field and if I am logged into the Craft CP, the form submission fails with a 400 error. If I log out of the CP and clear my cookies, I am able to submit the form successfully.
I also get a 400 bad request when trying to log into the CP after my form submits successfully.
@meyerweb @daltonrooney Just downloaded and installed the latest Firefox nightly and wasn't able to reproduce this, unfortunately. Nothing around this I can think of has changed for 3.1 beat, either. If you clear the browser's cache and try again does that fix it? The CSRF cookie value changes depending on if you were logged in or anonymous... did that status change while you were testing?
I get the exact same error from time to time and can't figure out what's causing it.. It appears to sneak in the site after x amount of days for some reason. The error then persists until I log into the cms. After that, the contact form submits fine, logged in or out, doesn't matter.
Could this be some sort of faulty caching somewhere? Though there are no cache tags in the templates, and no Blitz / ... plugins are installed.
Edit: the issue is definately caching. Maybe opcache was the culprit.
Going to go ahead and close this, but feel free to comment back if anyone is still hitting it.