Laravel

Laravel Signed URLs: Secure Temporary Links

January 16, 2026 1 min read 20 views

Secure URLs with signing:

Generate Signed URL

$url = URL::signedRoute('unsubscribe', ['user' => $user->id]);

Temporary Signed URL

$url = URL::temporarySignedRoute(
    'download',
    now()->addMinutes(30),
    ['file' => $file->id]
);

Validate in Controller

public function download(Request $request)
{
    if (!$request->hasValidSignature()) {
        abort(401);
    }
}

Middleware

Route::get('/download/{file}', [DownloadController::class, 'show'])
    ->middleware('signed');
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!