Correctly return files of the correct type #1

Closed
opened 2025-06-19 11:09:09 +00:00 by Andromeda · 1 comment
Owner

set the content-type response header appropriately based on a) file extension and b) Accept request header. Currently the blog is broken because the css is returned as text/plain!

set the content-type response header appropriately based on a) file extension and b) Accept request header. Currently [the blog](https://blog.mtgmonkey.net) is broken because the css is returned as text/plain!
Andromeda added the
Kind/Bug
Priority
Critical
labels 2025-06-19 11:43:51 +00:00
Author
Owner

Pull request d214b0bf86 fixed this issue, recognising text/javascript, text/css, text/html, image/png, and image/jpeg automatically based on file extensions and setting the Content-Type header accordingly. Otherwise, the Content-Type header is not set and is left to MIME sniffing or whatever on the browser side or on the part of a reverse proxy a user may be using (ferron, nginx, caddy, etc.)

Pull request d214b0bf8646ee7f2f0792bbf3b96db8dacc2468 fixed this issue, recognising text/javascript, text/css, text/html, image/png, and image/jpeg automatically based on file extensions and setting the Content-Type header accordingly. Otherwise, the Content-Type header is not set and is left to MIME sniffing or whatever on the browser side or on the part of a reverse proxy a user may be using (ferron, nginx, caddy, etc.)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Andromeda/rust-http-server#1
No description provided.