When a user clicks on the link in my mail it will be forwarded to the signed url I created. The controller method looks like this:
public function show(Request $request)
{
//Remove default sendinblue query parameters
foreach (array_keys($request->all()) as $key) {
if (! in_array($key, ['expires', 'signature'])) {
$request->server->remove($key);
}
}
if (! $request->hasValidSignature()) {
return redirect()->to('https://snuffelbox.nl');
}
//Passes
}
The problem is that my mail provider is always adding query parameters like utm_source
etc, making the request invalid. So that's why I'm stripping all query parameters except for expires
and signature
.
In the ->hasValidSignature() method Laravel is using this for getting the url:
$request->server->get('QUERY_STRING')
But no matter what I try I can't strip the query parameters from the url.
This is not working:
$request->server->remove($key);
And neither is this:
$request->request->remove($key);
Any idea how I can fix this problem?
--EDIT--
Url from mail:
What it should become (then it's valid, already tested that):
Signed route is created like this:
$link = URL::signedRoute('inertia.upsell.show', [$group->id, $order->token]);