简体   繁体   English

防止Apache自动更改MIME类型

[英]Prevent apache from automatically change mime type

I generate a Wave-File with PHP. 我用PHP生成Wave-File。 The data is read from a wav file on the server, manipulated and finally sent to the user. 从服务器上的wav文件读取数据,对其进行操作并最终将其发送给用户。

The problem now: Apache delivers this file as Content-Type: application/x-wave. 现在的问题是:Apache将该文件作为Content-Type:application / x-wave交付。 Even though I use header('Content-Type: audio/wave') and the script has extension .php. 即使我使用header('Content-Type:audio / wave')并且脚本的扩展名为.php。

At a first glance, Apache has no way to know that I'm sending a wav-file. 乍一看,Apache无法知道我正在发送wav文件。 So I guess it detects the mime type automatically from the content being sent. 因此,我猜它会自动从发送的内容中检测出mime类型。 Is there a way to stop this behavior and force Apache to use the mime type which is specified by header(...)? 有没有一种方法可以停止这种行为,并强制Apache使用header(...)指定的mime类型?

The reason why this mime type issue leads to a problem is: Firefox does not accept application/x-wave, but It accepts audio/wave. 该mime类型问题导致出现问题的原因是:Firefox不接受application / x-wave,但接受音频/ wave。

It turned out that there is mod_mime_magic installed on the server. 原来,服务器上安装了mod_mime_magic。 This mod will automatically set the mime type automatically according to the data stream leaving the server. 此mod将根据离开服务器的数据流自动自动设置mime类型。 So I can do whatever I want, the file will always leave the server as application/x-wave. 因此,我可以做任何我想做的事情,该文件将始终作为application / x-wave离开服务器。

Since I do not have access to mod_mime_magic configuration, I'm currently checking with my provider what they can do. 由于我无权访问mod_mime_magic配置,因此我目前正在与提供商联系,以了解他们可以做什么。

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

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