Skip to content

Keep the query when redirecting to add a trailing slash - #560

Merged
lo-simon merged 1 commit into
sony:masterfrom
garethsb:bugfix/redirect-keeps-query
Dec 2, 2026
Merged

lo-simon merged 1 commit into
sony:masterfrom
garethsb:bugfix/redirect-keeps-query

Conversation

@garethsb

@garethsb garethsb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

The admin UI redirects a request for /admin, or for a directory such as /admin/sdpoker, to the same path with a trailing slash. The redirect dropped the query, so a link such as /admin/sdpoker?url=... opened SDPoker without its url parameter. Both redirects, in nmos::experimental::make_api_sub_route and in the filesystem route, now keep the query.

RFC 3986 Section 3.4 says the query, along with the path, serves to identify a resource, and RFC 9110 Section 15.4.8 says a 307 (Temporary Redirect) indicates that the target resource resides temporarily under a different URI. RFC 9110 Section 10.2.2 has a user agent keep the fragment when the Location has none, but nothing carries the query over, so the server has to include it. Apache's mod_dir DirectorySlash, which inspired the filesystem route's directory redirect, also keeps the query.

A new test, testAdminUiRedirectKeepsQuery, checks both redirects with and without a query.

Co-authored-by: Gareth's 🤖 buddy

The admin UI redirected a request for /admin, or for a directory such
as /admin/sdpoker, to the same path with a trailing slash, but dropped
the query, so a link such as /admin/sdpoker?url=... lost its url
parameter.

RFC 3986 Section 3.4 says the query, along with the path, serves to
identify a resource, and RFC 9110 Section 15.4.8 says a 307 (Temporary
Redirect) indicates that the target resource resides temporarily under
a different URI. RFC 9110 Section 10.2.2 has a user agent keep the
fragment when the Location has none, but nothing carries the query
over, so the server has to include it. Apache's mod_dir DirectorySlash,
which inspired nmos::experimental::make_directory_index_redirect_handler,
also keeps the query.

Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>

@lo-simon lo-simon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lo-simon
lo-simon merged commit d1fc722 into sony:master Dec 2, 2026
20 of 24 checks passed
@garethsb
garethsb deleted the bugfix/redirect-keeps-query branch December 2, 2026 14:50
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

Successfully merging this pull request may close these issues.

2 participants