framework: Invalid Signature - Email Verification - HTTPS
- Laravel Version: 5.8.14
- PHP Version: 7.3.4
- Database Driver & Version: mysql 5.7
Description:
When using HTTPS, the email validation link gets invalid and returns an HTTP Error with 403 Invalid signature.
. When using HTTP, everything works fine (but insecure).
PS: After enabling HTTPS every link uses HTTPS (also the one in the email).
Steps To Reproduce:
- Edit the file
app/Providers/AppServiceProvider.php
and add the following lines of code in the methodboot
:
if(env('FORCE_HTTPS')) {
URL::forceScheme('https');
}
- Set the environment variable
FORCE_HTTPS
totrue
. - Run
php artisan config:cache
if the changes haven’t been applied.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (1 by maintainers)
I had a similar problem - it can be solved very easy if you use the TrustedProxy Middleware.
Add \URL::forceScheme(‘https’); to the boot method in AppServiceProvider.php
Allow all like below or configure proxies as explained in the docs: https://laravel.com/docs/5.8/requests#configuring-trusted-proxies
Thanks man it works.
In my case, it was the misconfiguration in NGINX
the
$query_string
was missing.403 | INVALID SIGNATURE
Solve the problemfirst go to path, app->Http->Middleware->TrustProxies.php
change this code…
yes, it works 😃
Also works for me!!
If you use Nginx to web server, you must add following configuration to .conf file: