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

Public assets 404 Not Found with Nitro publicAssets maxAge is set. #26517

Open
ploca14 opened this issue Mar 27, 2024 · 6 comments · May be fixed by #26679
Open

Public assets 404 Not Found with Nitro publicAssets maxAge is set. #26517

ploca14 opened this issue Mar 27, 2024 · 6 comments · May be fixed by #26679

Comments

@ploca14
Copy link

ploca14 commented Mar 27, 2024

Environment

  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.11.1
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.5
  • Package Manager: npm@10.2.3
  • Builder: -
  • User Config: devtools, nitro
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-kjtmai?file=nuxt.config.ts

Describe the bug

When attempting to set Cache-Control headers for assets using the maxAge option using the nitro.publicAssets option, causes the assets to return a 404 error.

Additional context

No response

Logs

No response

Copy link

stackblitz bot commented Mar 27, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@danielroe
Copy link
Member

Would you see if you can reproduce this in pure Nitro (reproduction sandbox), and if so, raise there? 🙏

@userquin
Copy link
Member

userquin commented Apr 6, 2024

dir seems to be not resolved (Nuxt aliases don't work, check Elk commit below), we need a resolver, here a working example (linked SB reproduction fork ):
https://stackblitz.com/edit/github-kjtmai-mrrd7c?file=nuxt.config.ts

Can be checked with Elk in dev server, check this commit elk-zone/elk@932af07 .

Screenshot using the playground in my Nuxt local clone:

imagen

@userquin
Copy link
Member

userquin commented Apr 6, 2024

The problem seems to be also in nuxt, it is ignoring the aliases in layers:

It seems server routes with same problem.

@userquin
Copy link
Member

userquin commented Apr 6, 2024

publicAssets not being resolved, only public dirs

@userquin
Copy link
Member

userquin commented Apr 6, 2024

I'm preparing a PR for publicAssets, including also Nuxt alias:

imagen

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

Successfully merging a pull request may close this issue.

3 participants