我遇到了Spring Boot应用程序的问题,它应该提供静态的.webm和.mp4文件 . 当我将文件放在类路径的 static
文件夹中时,应用程序使用内容类型 application/octet-stream
而不是 video/webm
为它们提供服务,这使得它们无法使用 <video>
标记 . 我've tried customizing the resource handler, but it doesn'似乎提供了任何设置标头的方法 . 图像和其他文件工作正常 .
Spring Boot输出:
$ curl -s -D - localhost:8080/CmMs.webm -o /dev/null
HTTP/1.1 200
Last-Modified: Tue, 05 Jul 2016 18:08:41 GMT
Accept-Ranges: bytes
Content-Type: application/octet-stream
Content-Length: 648708
Date: Tue, 05 Jul 2016 18:22:40 GMT
输出应该看起来
$ curl -s -D - http://webm.land/media/CmMs.webm -o /dev/null
HTTP/1.1 200 OK
Server: nginx/1.1.19
Date: Tue, 05 Jul 2016 18:23:21 GMT
Content-Type: video/webm
Content-Length: 648708
Last-Modified: Tue, 05 Jul 2016 17:42:08 GMT
Connection: keep-alive
Accept-Ranges: bytes
1 回答
Anton Novopashin的回答就是这个伎俩 . 这有助于: