Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

📌 Fixes

Resolves issue where Safari redirects kubestellar.io to /docs instead of /en due to cached 301 redirects.


📝 Summary of Changes

Safari aggressively caches 301 permanent redirects. Users with cached redirects from a previous configuration continue redirecting to /docs instead of the correct /en landing page.

Added explicit root path handling in middleware to override cached redirects using HTTP 307 (temporary redirect).


Changes Made

  • Added explicit root path check in src/middleware.ts before i18n middleware
  • Changed redirect status from implicit 301 to explicit 307 to prevent browser caching
  • Verified TypeScript compilation and linting

Technical change:

// Explicitly handle root path to ensure consistent redirect to /en
if (request.nextUrl.pathname === "/") {
  const url = request.nextUrl.clone();
  url.pathname = `/${defaultLocale}`;
  return NextResponse.redirect(url, 307); // Prevents aggressive caching
}

Checklist

  • I have reviewed the project's contribution guidelines.
  • I have written unit tests for the changes (if applicable).
  • I have updated the documentation (if applicable).
  • I have tested the changes locally and ensured they work as expected.
  • My code follows the project's coding standards.

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 intlMiddleware to ensure precedence.

Expected behavior post-deployment:

  • kubestellar.iokubestellar.io/en
  • kubestellar.io/docs → unchanged ✓
  • docs.kubestellar.iokubestellar.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
    • Triggering command: /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

This section details on the original issue you should resolve

<issue_title>bug: When I go to kubestellar.io in safari, i get redirected to kubestellar.io/docs. When i go to kubestellar.io in chrome, i go to kubestellar.io/en. Chrome is behaving correctly, safari is not</issue_title>
<issue_description>### Describe the bug

When I go to kubestellar.io in safari, i get redirected to kubestellar.io/docs. When i go to kubestellar.io in chrome, i go to kubestellar.io/en. Chrome is behaving correctly, safari is not

Output from KubeStellar-Snapshot.sh

No response

Steps To Reproduce

open safari and go to kubestellar.io - observe redirect to kubestellar.io/docs - this is wrong

open chrome and go to kubestellar.io - observe redirect to kubestellar.io/en - this is right

open either browser and go to kubestellar.io/docs - both redirect to kubestellar.io/docs - this is correct.

Expected Behavior

go to kubestellar.io and redirect to kubestellar.io/en landing page

go to kubestellar.io/docs and get kubestellar.io/docs page

Want to contribute?

  • I would like to work on this issue.

Additional Context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@netlify
Copy link

netlify bot commented Dec 15, 2025

Deploy Preview for kubestellar-docs ready!

Name Link
🔨 Latest commit db968e5
🔍 Latest deploy log https://app.netlify.com/projects/kubestellar-docs/deploys/69406a6e715d3500097f54c2
😎 Deploy Preview https://deploy-preview-415--kubestellar-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

This change adds an explicit check for the root path (/) in the middleware
to ensure it always redirects to /en (the default locale). This helps
override any cached redirects in browsers like Safari that may have
cached an old redirect to /docs.

Using 307 (Temporary Redirect) instead of 301 to avoid aggressive caching
by browsers, which was likely the cause of Safari's incorrect behavior.

Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incorrect redirect from kubestellar.io in Safari Fix root path redirect to /en for Safari caching issue Dec 15, 2025
Copilot AI requested a review from clubanderson December 15, 2025 20:09
@clubanderson clubanderson marked this pull request as ready for review December 15, 2025 20:16
@clubanderson
Copy link
Contributor

@naman9271 @btwshivam ptal - this fixes one of the issues that came from adding the docs redirect last week

@clubanderson
Copy link
Contributor

the preview lgtm, I did not hear any feedback from @btwshivam or @naman9271 so I will assume this fix is acceptable.

@clubanderson clubanderson merged commit def4c69 into main Dec 16, 2025
6 of 7 checks passed
@clubanderson clubanderson deleted the copilot/fix-safari-redirect-issue branch December 16, 2025 14:37
@github-actions
Copy link
Contributor

🎉 Thank you for your contribution! Your PR has been successfully merged.

We’d love to hear your thoughts to help improve KubeStellar.
Please take a moment to fill out our short feedback survey:

https://kubestellar.io/survey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants