docs(filters): note static() second-parameter file vs. directory pitfall#3965
Open
mvanhorn wants to merge 1 commit intozalando:masterfrom
Open
docs(filters): note static() second-parameter file vs. directory pitfall#3965mvanhorn wants to merge 1 commit intozalando:masterfrom
mvanhorn wants to merge 1 commit intozalando:masterfrom
Conversation
|
Cannot start a pipeline due to: Click on pipeline status check Details link below for more information. |
szuecs
approved these changes
Apr 15, 2026
Member
|
@mvanhorn can you please signoff you commit ? should do the trick |
If `static()` is called with a target path that ends in `/index.html` (rather than the parent directory), requests get a 301 redirect with a `Location: ..//` header, inherited from Go's `http.FileServer` "redirect any request ending in /index.html to the same path without the final index.html" behavior. Document the pitfall and the fix in the existing `Notes` list so users hitting it have something to find. Issue zalando#2233. Closes zalando#2233 Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
0160163 to
c78dde0
Compare
Member
|
👍 |
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.
Issue #2233 documented a confusing redirect: setting
static("/foo", "/tmp/foo/index.html")(with the second parameter pointing directly at a file namedindex.html) returns301 Moved PermanentlywithLocation: ..//. The cause is Go'shttp.FileServer"redirect any request ending in /index.html to the same path without the final index.html" behavior, inherited transitively bystatic().The reporter asked to document this as an edge case in the filter docs. The existing
Noteslist near thestaticfilter does mention the symmetric case (GET /foo/index.htmlredirects to/foo/) but doesn't call out that pointing the second parameter at a file - rather than its parent directory - hits the same redirect. This PR adds one bullet covering that case, with the fix (use the parent directory) inline.No code changes; doc-only.
Closes #2233.
This contribution was developed with AI assistance (Claude Code).