如何为Azure托管的Flask应用程序启用字节范围请求以符合Itunes播客要求?

时间:2017-01-06 16:26:14

标签: azure iis itunesconnect podcast

我正在尝试在运行Flask时在Azure上托管播客。我不认为Flask / Python部分在这里是相关的,因为.mp3文件是直接从IIS提供的静态内容。

当尝试使用Itunes验证我的XML时,我收到此消息:

Can’t submit your feed. Your episodes are hosted on a server which does not support byte-range requests. Enable byte-range requests and try again.

我还没有弄清楚如何做到这一点。

1 个答案:

答案 0 :(得分:0)

您指的是哪种Azure服务?

默认情况下,在应用服务中Accept-Ranges处于启用状态:

$ curl -i http://surpriseapp.azurewebsites.net/song.mp3

HTTP/1.1 200 OK
Content-Length: 10114593
Content-Type: audio/mpeg
Accept-Ranges: bytes    

Lavf52.84.0 ���D  �aA�Kr���a�n��=-㏼`�1� ��i
q�D5��e�/@kq|�:�G3%�`|K�cX�����kי��q��ŎNR�ם
<< rest of binary content follows >>


$ curl -i -H "Range: bytes=0-" http://surpriseapp.azurewebsites.net/song.mp3

HTTP/1.1 206 Partial Content
Content-Length: 10114593
Content-Type: audio/mpeg
Content-Range: bytes 0-10114592/10114593
Accept-Ranges: bytes

Lavf52.84.0 ���D  �aA�Kr���a�n��=-㏼`�1� ��i
q�D5��e�/@kq|�:�G3%�`|K�cX�����kי��q��ŎNR�
<< rest of binary content follows >>


$ curl -i -H "Range: bytes=200-300" http://surpriseapp.azurewebsites.net/song.mp3

HTTP/1.1 206 Partial Content
Content-Length: 101
Content-Type: audio/mpeg
Content-Range: bytes 200-300/10114593
Accept-Ranges: bytes

3��P�P�(�|�LF�����?4s�
 A ���� <<<<0��Y�ms�|�晍l���2��FsP]A�x&�Ó�����;%�`L

希望Apple在没有明确向请求发送206 Partial Content标头的情况下期待Range:。那太傻了。