Fix root path redirect to /en for Safari caching issue #415
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.
📌 Fixes
Resolves issue where Safari redirects
kubestellar.ioto/docsinstead of/endue to cached 301 redirects.📝 Summary of Changes
Safari aggressively caches 301 permanent redirects. Users with cached redirects from a previous configuration continue redirecting to
/docsinstead of the correct/enlanding page.Added explicit root path handling in middleware to override cached redirects using HTTP 307 (temporary redirect).
Changes Made
src/middleware.tsbefore i18n middlewareTechnical change:
Checklist
Screenshots or Logs (if applicable)
N/A - Middleware redirect behavior change
👀 Reviewer Notes
Using 307 instead of 301/302 ensures browsers don't cache the redirect. This allows users with stale Safari caches to receive the correct redirect after deployment. The check runs before
intlMiddlewareto ensure precedence.Expected behavior post-deployment:
kubestellar.io→kubestellar.io/en✓kubestellar.io/docs→ unchanged ✓docs.kubestellar.io→kubestellar.io/docs✓Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fonts.googleapis.com/usr/local/bin/node node /home/REDACTED/work/docs/docs/node_modules/.bin/next build(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.