简体   繁体   中英

Express: send Content-Type on 304 Not Modified

app.use(express.static('./public'));

Express sends a valid mime by using the snippet above - but only once . After the client cached the response, every request returning a 304 Not Modified , will be answered without any Content-Type header.

Is express able to send a Content-Type on cached responses? Or is it a bad idea in general?

Background: Our beloved IE seems to demand a valid mime ( CSS was ignored due to mime type mismatch ) for asynchronously requested CSS files.

A 304 response has no body and the purpose of the content-type header is to identify the response body, so it doesn't make sense to have content-type with a 3XX response. Can you point to a specific reproducible sequence of request/responses and an exact IE version to reproduce your problem? I've never heard anyone complaining about this issue before, so I suspect this is not actually your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM