How to fix Laravel 403 Invalid Signature

Fermin Perdomo Fermin Perdomo
schedule 1 min read

If you are using a mail service provider like SendGrid, it can create a proxy that may cause issues when you try to validate emails, for example.

To fix this, go to your bootstrap app file and add this line to the middleware:

$middleware->trustProxies(at: '*');

Then it should look like this:

// bootstrap/app.php 
<?php 

use Illuminate\Foundation\Application; 
use Illuminate\Foundation\Configuration\Exceptions; 
use Illuminate\Foundation\Configuration\Middleware; 

return Application::configure(basePath: dirname(__DIR__)) 
    ->withRouting( 
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php', health: '/up', 
    ) 
    ->withMiddleware(function (Middleware $middleware) { 
        $middleware->trustProxies(at: '*'); 
    }) 
    ->withExceptions(function (Exceptions $exceptions) { // 
    })
    ->create();

Reactions

lock You need to be logged in to react.
Log In

Newsletter

Get new posts delivered straight to your inbox.

mail

Great Tools for Developers

Git Tower

Git Tower

A powerful Git client for Mac and Windows that simplifies version control.

Visit arrow_forward
Mailcoach

Mailcoach

Self-hosted email marketing platform for sending newsletters and automated emails.

Visit arrow_forward
Uptimia

Uptimia

Website monitoring and performance testing tool to ensure your site is always up and running.

Visit arrow_forward
Cloudways

Cloudways

Managed cloud hosting platform that simplifies server management for developers.

Visit arrow_forward

Comments

No comments yet. Be the first to share your thoughts.

chat_bubble Join the conversation — log in to leave a comment.
Log In