can you please suggest me I have transferred my site from one server to another, all Magento functionality works except add to cart.

And checkout cart add controller return 500 error

I am getting below error in debug.log

Request validation failed for action "Magento\Framework\App\Action\Forward\Interceptor" {"exception":"[object] (Magento\Framework\App\Request\InvalidRequestException(code: 0): Invalid request received at /home/simplecity/public_html/vendor/magento/framework/App/Request/CsrfValidator.php:105)"} []

  • Please add the error you're getting, check error and systemlog. Check in the network and console tab on dev console ito check if you're getting any error there. Jun 16 '20 at 11:09
  • yes @VivekKumar error addedd Jun 16 '20 at 11:39
  • can you add url here where you get this error and menu.xml file for the same ? Jun 16 '20 at 15:41
  • This error is in debug.log not in any console or network error Jun 16 '20 at 19:40

I Ignored Validation use plugin as below :

Module_Name/etc/di.xml add:

<type name="Magento\Framework\App\Request\CsrfValidator">
    <plugin name="csrf_validator_skip" type="Module\Name\Plugin\CsrfValidatorSkip" />


namespace Module\Name\Plugin;

class CsrfValidatorSkip
     * @param \Magento\Framework\App\Request\CsrfValidator $subject
     * @param \Closure $proceed
     * @param \Magento\Framework\App\RequestInterface $request
     * @param \Magento\Framework\App\ActionInterface $action
    public function aroundValidate(
        \Closure $proceed,
    ) {
        /* Magento 2.1.x, 2.2.x */
        if ($request->getModuleName() == 'name') {
            return; // Skip CSRF check
        $proceed($request, $action); // Proceed Magento 2 core functionalities

My Error was as below:

main.DEBUG: Request validation failed for action "Module\Name\Controller\HtmlRedirect\Response\Interceptor" {"exception":"[object] (Magento\Framework\App\Request\InvalidRequestException(code: 0): Invalid request received at MagentoRoot/vendor/magento/framework/App/Request/CsrfValidator.php:105)"} []

  • 1
    thanks it's solved my issue
    – mrfizh
    Jun 9 at 18:48

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.