Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

infernobass7's avatar

requests causing a 403 forbidden error

I have a form that when I submit it with the plain Request it completes fine and redirects correctly. However the PagesRequest I used to handle the request returns a 403 forbidden error. I am not sure why. permissions are exactly the same between the two.

0 likes
2 replies
Kenneth_H's avatar

Try looking in the authorize() method of your custom FormRequest. It would probably look like this:

public function authorize()
    {
        return false;
    }

Change it to this:

public function authorize()
    {
        return true;
    }

The method is for checking your access rights for performing the request.

3 likes
mushood's avatar

Since I got this from google, leaving a note

If you applied a policy to your route and also a customRequest in your controller, both will be checked.

Please or to participate in this conversation.