Preserve requested URL through authentication
Describe what you are trying to accomplish and why in non technical terms
I use direct links into specific Frigate pages, especially Explore pages with filters already applied.
For example:
https://frigate.example.com/explore?cameras=driveway&labels=person,car&zones=example_zone&after=1234567890&before=1234599999
If I am already authenticated, this works exactly as expected.
If I am not authenticated, Frigate correctly sends me to the login page. However, after I authenticate, Frigate takes me to the home page instead of taking me back to the URL I originally tried to access.
This makes deep links less useful for things like notifications, bookmarks, Home Assistant integrations, or other systems that link directly to a specific Frigate view.
Describe the solution you'd like
When an unauthenticated user requests a Frigate URL, preserve the original path and query string during the authentication process.
After a successful login, redirect the user back to the originally requested page instead of always sending them to the home page.
For example:
/explore?... → login → authentication succeeds → /explore?...
If someone goes directly to the login page, then continuing to send them to the home page after authentication makes sense.
The redirect should probably be limited to relative or same-origin Frigate URLs so that this does not introduce an open redirect issue.
Describe alternatives you've considered
At the moment, the workaround is to authenticate first and then open the original link again.
This works, but it significantly reduces the usefulness of deep links because the user has to go back and re-open the notification, bookmark, or original link after authentication.
I also reviewed the documented login page redirection functionality. My understanding is that this is intended for external authentication / reverse proxy scenarios and does not address preserving the originally requested Frigate URL when using Frigate's native authentication.
Additional context
A simple way to reproduce this is:
- Start with no active Frigate session.
- Open a direct URL to an Explore page with filters or other query parameters.
- Frigate sends you to the login page.
- Authenticate successfully.
- Frigate opens the home page instead of the original Explore URL.
The direct URL itself works correctly when the user is already authenticated. The issue is only that the original destination is lost during authentication.
Source: blakeblackshear/frigate