-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[yii\web\HttpException:400] yii\web\BadRequestHttpException: Unable to verify your data submission. in /var/www/vendor/yiisoft/yii2/web/Controller.php:225 #19166
Comments
Please try newest Yii version and let us know if problem persist. |
I have this issue also with version 2.0.45 and PHP 7.4.19 |
@krysimplas |
@virtual-designer it should not be a problem to still use that. @krysimplas @developedsoftware could you prepare a minimal version of the app that will allow us to reproduce the problem? |
It has been 2 or more weeks with no response on our request for more information. If you want it to be reopened again, feel free to supply us with the requested information. Thanks! This is an automated comment, triggered by adding the label |
I am having the exact same issue, but with the following setup: PHP 8.1.7 Can you please re-open this issue? So, it turned out the culprit was Varnish; or more precisely - because this particular page was not in the Varnish policy. We've added it, and now it all works as expected. Sorry for the noise. |
Do you have a favicon? Are you using Firefox? |
@developedsoftware I was using Chrome... I don't think a favicon is the real issue here. |
I thought that and wasted hours debugging. I hadn’t supplied a favico at the public root - which meant index.php was processing the request for a favico (as the file couldn’t not be found using try_files in nginx). Which would then change the csrf token on the server after the token had been inserted into my form doing a post request. And then on submission the above error occurred. I laughed and cried when I eventually figured it out. I would check you aren’t doing any Ajax requests after your form is loaded or any other request that yii would process. Whenever it does the csrf token changes and your form then has a invalid csrf token |
What steps will reproduce the problem?
Submitting any form, in this instance we are at the main login controller and submitting a username/password combination. The user registration form is also exhibiting the identical problem.
What is the expected result?
The user would be logged in successfully and see the next portion of the application when authentication is complete.
What do you get instead?
Bad Request (#400)
Unable to verify your data submission.
Additional info
We've tried in multiple browsers, Chrome, Firefox, and also cleared full cache, cookies, etc.
We've read through other Issues with the same errors but have not had success implementing anything from those. This is a full dump from the Yii2 app.log with additional information on the CSRF tokens that are set when posting the form.
The text was updated successfully, but these errors were encountered: