Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: subdomain redirect for dir CIDs #7165

Merged
merged 1 commit into from Apr 15, 2020
Merged

Conversation

lidel
Copy link
Member

@lidel lidel commented Apr 15, 2020

Closes #7164

Note: due to the way http in golang works, status code can be set only once.
There is a known issue with prometheus/client_golang: it sometimes produces superfluous response.WriteHeader call and if it is executed first, the status code set in our code is ignored.

In this PR I set the redirect status code before executing the template to avoid potential race condition, feels like the least invasive way of making this work reliably.

@lidel lidel requested a review from Stebalien April 15, 2020 11:48
Closes #7164

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
@lidel lidel force-pushed the fix/subdomain-dir-redirect branch from 5ee1295 to 8290ec1 Compare April 15, 2020 21:52
@Stebalien Stebalien merged commit 6f4608b into master Apr 15, 2020
@Stebalien Stebalien deleted the fix/subdomain-dir-redirect branch April 20, 2020 16:37
hacdias pushed a commit to ipfs/boxo that referenced this pull request Jan 27, 2023
fix: subdomain redirect for dir CIDs

This commit was moved from ipfs/kubo@6f4608b
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.

Subdomain redirect doesn't apply to directory listings
2 participants