How to send correct image content type header for static generated on nginx? #1127
Unanswered
pixelpaulaus
asked this question in
Q&A
Replies: 1 comment
-
|
For a fully static site, Nginx will normally choose You have a few practical options:
For Nginx, the fix is usually a targeted location rule for the generated image route/pattern, not changing global MIME behavior. For example, if all converted WebP files are under an The core issue is that static servers do not inspect image bytes like Nuxt's runtime server can; they rely on path/MIME config. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
Seeing as NuxtIMG does not modify the filename extensions. If you serve the image via the server nuxt, it knows to send the correct content type header. However, if you generate a static site and serve it via something like nginx. it will get the desired header to send from the extension of the file (image.jpg). So instead of sending webp as the content type, it will send jpg as per the file extension.
So how does everyone else get the correct content type sent on nginx hosts?
Beta Was this translation helpful? Give feedback.
All reactions