Skip to content
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

Can't change email address of John Doe admin user -> invalid signature #124

Open
gitwittidbit opened this issue Sep 10, 2024 · 1 comment
Assignees

Comments

@gitwittidbit
Copy link

Hi,

So I just installed Helper from scratch. It is running behind a ssl terminating reverse proxy under a domain name like this https://helper.example.com.

When I try to change the John Doe admin user's email address, I get the verification email but when I click on the link, Helper displays "Invalid Signature".

What might be the problem?

Thanks!

@TsuLee
Copy link

TsuLee commented Nov 29, 2024

The "Invalid Signature" error you're seeing when clicking the verification link in the email is typically related to a mismatch between the signature generated in the URL and the server's signature verification process. This can happen when the application is behind a reverse proxy, particularly when SSL is terminated at the proxy.

1. Session Configuration (Signed URLs and Session Handling):

Laravel uses signed URLs to ensure the integrity of the data. When you're behind a reverse proxy or load balancer, sometimes the session or signature verification may fail if the configuration isn’t set up to handle it properly.

Update the session domain in your config/session.php file:
'domain' => env('SESSION_DOMAIN', '.example.com'), // Set the correct domain here

Make sure that the session cookie is set to work across all subdomains (e.g., .example.com for helper.example.com).

Also, verify that your APP_URL in .env is set correctly:
APP_URL=https://helper.example.com

2. SSL and Trusted Proxies:

Laravel needs to be aware of the fact that it is behind a proxy and SSL is terminated outside the application. Without this, Laravel may not correctly identify the scheme (HTTP or HTTPS) or might incorrectly handle the proxy headers.

In app/Http/Middleware/TrustProxies.php, ensure that the middleware is correctly handling the proxy. You should have something like this:

use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;

class TrustProxies extends Middleware
{
    /**
     * The trusted proxies for this application.
     *
     * @var array
     */
    protected $proxies = '*'; // You can limit this to your proxy's IP

    /**
     * The headers that should be used to detect proxies.
     *
     * @var int
     */
    protected $headers = Request::HEADER_X_FORWARDED_ALL;
}

3. Verify APP_KEY:

The "Invalid Signature" error can also occur if there’s an issue with your APP_KEY. The key used to generate the signed URLs may be incorrect or mismatched.

Ensure your .env file has the correct APP_KEY:
APP_KEY=your_base64_encoded_key

Or generate it :
php artisan key:generate

4. try cleaning the cache :

php artisan config:clear
php artisan cache:clear
php artisan session:clear

Hope it helps !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants