简体   繁体   English

快递:在304上发送Content-Type未修改

[英]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 . Express通过使用上面的代码段发送有效的mime ,但仅发送一次 After the client cached the response, every request returning a 304 Not Modified , will be answered without any Content-Type header. 客户端缓存响应304 Not Modified ,将返回每个返回304 Not Modified请求,而不会包含任何Content-Type标头。

Is express able to send a Content-Type on cached responses? 表达是否能够在缓存的响应上发送Content-Type 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. 背景:我们心爱的IE似乎要求为asynchronously请求的CSS文件提供有效的mime由于mime类型不匹配,CSS被忽略了 )。

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. 304响应没有正文,而content-type标头的目的是标识响应正文,因此对于具有3XX响应的content-type没有意义。 Can you point to a specific reproducible sequence of request/responses and an exact IE version to reproduce your problem? 您能否指出请求/响应的特定可重现顺序以及确切的IE版本来重现您的问题? I've never heard anyone complaining about this issue before, so I suspect this is not actually your issue. 我以前从未听说过有人抱怨此问题,因此我怀疑这实际上不是您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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