非动态自定义HTTP头 [英] Non-dynamic custom HTTP headers

查看:163
本文介绍了非动态自定义HTTP头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据这个对Ogg媒体 Mozilla的文章,媒体工作更加无缝地在浏览器中与 X-内容时长头,给了一张秒的长度。

According to this Mozilla article on Ogg media, media works more seamlessly in the browser with an X-Content-Duration header, giving the length in seconds of the piece.

假设我已经存储的长度地方(当然在数据库中,或许也会在文件名本身(视频文件name.XXX.ogv ,其中 XXX 是以秒为单位的时间)),有没有什么办法,形成只用阿帕奇的.htaccess 设置这个额外的头?我问,因为该文件加载到一个PHP脚本看起来笨拙,尤其是当PHP会默认添加该禁用缓存等标题,而不会恰当地范围(部分内容)的请求。是的,很多code的,可以用PHP编写的,支持的ETag和范围的请求,但它似乎像矫枉过正尽一切只是为了添加一个头,当阿帕奇拥有所有内置的功能。

Assuming that I have that length stored somewhere (certainly in a database, perhaps also in the filename itself (video-file-name.XXX.ogv, where XXX is the time in seconds)), is there any way to form this extra header using only Apache .htaccess settings? I ask because loading the file into a PHP script seems clumsy, especially when PHP will by default add other headers which disable caching, and won't respond properly to range (partial content) requests. Yes, a lot of code could be written in PHP to support ETags and range requests, but it seems like overkill to do all that just to add one header, when Apache has all that functionality built in.

推荐答案

这是的 mod_cern_meta 。它允许静态分配额外的HTTP头文件。

This is the domain of mod_cern_meta. It allows statically assigning extra HTTP headers to files.

您可以使用cron作业,并为每个视频* .META文件。

You could use a cron job, and generate a *.meta file for every video.

这篇关于非动态自定义HTTP头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆