Improve page experience using try_files-ish approach for SPA/static pages#383
Open
inFocus7 wants to merge 3 commits intoagentregistry-dev:mainfrom
Open
Improve page experience using try_files-ish approach for SPA/static pages#383inFocus7 wants to merge 3 commits intoagentregistry-dev:mainfrom
try_files-ish approach for SPA/static pages#383inFocus7 wants to merge 3 commits intoagentregistry-dev:mainfrom
Conversation
…tic pages Signed-off-by: Fabian Gonzalez <fabian.gonzalez@solo.io>
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the embedded UI static file serving logic to behave more like try_files, improving reload behavior for Next.js static export routes (e.g., /deployed).
Changes:
- Replaces the plain
http.FileServerUI handler with a custom resolver: exact file →<path>.html→index.html. - Uses
http.ServeContentfor theindex.htmlfallback to avoidFileServerredirect behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Fabian Gonzalez <fabian.gonzalez@solo.io>
peterj
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation
A minor annoyance I hit is during development (and maybe it happens in production setups), I try to reload
/deployed, but this ends up loading a next.js directory tree instead of the page. We should be serving the page itself.Changes
try_filesapproach like in nginx, we fallback from (1) exact file matches, (2)*.html, (3) root SPA.ServeContentas dictated in the go docs, since hitting/redirects to, which i believe redirect to `/`, back to, infinitely.Change Type
Changelog
Additional Notes
Validation
Simply ran
make run-docker. May require browser cache clearance.Before
static.serve.-.before.mp4
After
static.serve.-.after.mp4