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

@react-router/serve not caching assets in /public for 1 hr #12570

Open
brookslybrand opened this issue Dec 17, 2024 · 1 comment
Open

@react-router/serve not caching assets in /public for 1 hr #12570

brookslybrand opened this issue Dec 17, 2024 · 1 comment

Comments

@brookslybrand
Copy link
Contributor

brookslybrand commented Dec 17, 2024

I'm using React Router as a...

framework

Reproduction

npx create-react-router@latest -y
cd my-react-router-app
npm run build
npm run start

Open up the network tab and go to localhost:3000. Look at the headers for the favicon

System Info

System:
    OS: macOS 15.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 99.05 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.17.0/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v20.17.0/bin/npm
    pnpm: 9.7.1 - ~/.nvm/versions/node/v20.17.0/bin/pnpm
    bun: 1.1.0 - ~/.bun/bin/bun
  Browsers:
    Chrome: 131.0.6778.140
    Safari: 18.1
  npmPackages:
    @react-router/dev: ^7.0.2 => 7.0.2 
    @react-router/node: ^7.0.2 => 7.0.2 
    @react-router/serve: ^7.0.2 => 7.0.2 
    react-router: ^7.0.2 => 7.0.2 
    vite: ^5.4.11 => 5.4.11 

Used Package Manager

npm

Expected Behavior

I expect assets in the public directory (like the favicon) to have a default cache of 1hr: public, max-age=3600

Actual Behavior

Assets in the public directory have a cache control of public, max-age=0

I'm confused because it seems like this line should be setting a cache control. I think this is how it worked with remix-serve

@abn5x
Copy link

abn5x commented Jan 4, 2025

same issue here... everything is set as "public, max-age=0, must-revalidate", doesn't matter if it's in the public folder or public/assets, any way I can set this myself?

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

No branches or pull requests

2 participants