You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example/hello.txt route should return Content-type: application/json header, and it does work in the PROD mode, but doesn't work in the DEV mode, where Content-type: text/plain; charset=UTF-8 is returned.
Try to access /hello.txt route and check the headers of the response:
When nitro.config.ts contains a routeRules section that sets headers for a static file (from public dir), then these headers are not set when the server is running in DEV mode (npm run dev). The headers are set, though, when the server is running in PROD mode (npm run build && npm run preview).
- These otherwise fail to be applied to public
assets (see nitrojs#2749).
- This change replies them redundantly in the
other cases (where they were already being
applied), but the alternative would require
duplicating or reversing the URL / file path
logic from the "send" package.
fixesnitrojs#2749
Environment
Node Version: v18.20.3
Nitro Version: 2.9.7
Reproduction
In this example
/hello.txt
route should returnContent-type: application/json
header, and it does work in the PROD mode, but doesn't work in the DEV mode, whereContent-type: text/plain; charset=UTF-8
is returned.Try to access
/hello.txt
route and check the headers of the response:DEV
mode.PROD
mode.public/hello.txt
nitro.config.ts
Describe the bug
When
nitro.config.ts
contains arouteRules
section that sets headers for a static file (frompublic
dir), then these headers are not set when the server is running in DEV mode (npm run dev
). The headers are set, though, when the server is running in PROD mode (npm run build && npm run preview
).Additional context
The bug was originally created as nuxt/nuxt#26740.
Logs
No response
The text was updated successfully, but these errors were encountered: