Skip to content

Conversation

@joseph0926
Copy link
Contributor

Description

When using a CDN with CORS headers, CSS files loaded via the <Links> component can fail due to browser cache behavior.

After #14463, React Router appends # suffix to CSS hrefs for dynamic imports. This causes Vite to make a separate request (since URLs differ), but both requests share the browser cache. If React Router's <link> lacks crossOrigin while Vite's has crossOrigin="anonymous", the cached response (without CORS headers) fails Vite's CORS check.

Changes

  • Add crossOrigin prop to LinksProps interface
  • Pass crossOrigin to <link> elements in Links component
  • Add tests for crossOrigin behavior

Impact

  • Probably no compatibility issues -> Because it was applied selectively via properties

Fixes #14678

@changeset-bot
Copy link

changeset-bot bot commented Dec 26, 2025

🦋 Changeset detected

Latest commit: c6d079d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
react-router Major
@react-router/architect Major
@react-router/cloudflare Major
@react-router/dev Major
react-router-dom Major
@react-router/express Major
@react-router/node Major
@react-router/serve Major
@react-router/fs-routes Major
@react-router/remix-routes-option-adapter Major
create-react-router Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@markdalgleish markdalgleish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@markdalgleish markdalgleish merged commit dd08f8d into remix-run:dev Jan 8, 2026
5 checks passed
@joseph0926 joseph0926 deleted the fix/links-crossorigin-prop branch January 8, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants