How can I turn on byte-range requests for my Azure hosted Flask application to comply with Itunes podcast demands?

1k views Asked by At

I'm trying to host a podcast on Azure while running Flask. I don't think the Flask/Python part is relevant here, though, as the .mp3 files are static content that get served directly from IIS.

When trying to validate my XML With Itunes, I get this message:

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.

And I haven't been able to figure out how to do this.

1

There are 1 answers

0
evilSnobu On

Which Azure service are you referring to?

In App Service Accept-Ranges is turned on by default:

$ 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

Hopefully Apple isn't expecting a 206 Partial Content without explicitly sending a Range: header with the request. That would be silly.