latest stable versions: v140909 (changelog)

Old Forums (READ-ONLY): The community now lives at WordPress.org. If you have an s2Member® Pro question, please use our new Support System.

Any way to set Accept-Ranges for downloads?

Home Forums Community Forum Any way to set Accept-Ranges for downloads?

This topic contains 7 replies, has 3 voices. Last updated by  Jason (Lead Developer) 1 year, 8 months ago.

Topic Author Topic
Posted: Friday Jun 1st, 2012 at 11:10 am #15171

I seem to be having an issue serving protected mp3 files because s2Member is setting the response header “Accept-Ranges” to “none”. Is there a way to either remove that header or even better, change it to “bytes” instead of “none”?

This is an issue because I am using jplayer to play mp3 files on my site and “seek” functionality does not work when the files are located in an s2Member-protected directory. It works fine when the files are served through my own php file which specifically sets the Accept-Ranges header to “bytes”, and it works fine when the files are accessed directly through an unprotected directory.

I tried disabling chunked and flushed file delivery via s2-hacks.php but it didn’t make a difference.

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Friday Jun 1st, 2012 at 11:38 pm #15230
Staff Member

Hi Paul.

I don’t know how to do that, but will email Jason asking him.

Posted: Tuesday Jun 5th, 2012 at 9:39 am #15509

Any response from Jason yet on this one?

Posted: Tuesday Jun 5th, 2012 at 10:05 pm #15612
Staff Member

Not yet, sorry. I sent it again just in case.

Posted: Thursday Jun 7th, 2012 at 8:42 pm #15871
Staff Member

Thanks for the heads up on this request for support.

@Paul Woods

Accept-Ranges: bytes

Setting this header would indicate to other servers/devices that s2Member is capable of serving byte-range requests, when it actually is not capable of this. At least, not yet. There are some considerations still being made about whether to include this functionality in the next major release, given some possible compatibility issues that it may introduce, from one host to another, and from one server software application to another.

Possible solution for you, in the mean time…

Generally speaking, if you’re going to do anything even remotely advanced with audio/video files (like seeking, where a stream, or a simulated stream is necessary), we suggest that you integrate s2Member with Amazon® S3, and even with the Amazon® S3/CloudFront combination (if that’s possible for you).

See also: Dashboard -› s2Member® -› Download Options -› Amazon® S3/CDN Storage

This will give you a much faster, and more reliable experience, where audio/video files are concerned. In addition, if s2Member is integrated with Amazon® CloudFront, both audio/video files can be delivered over the RTMP protocol, so that playback devices like JW Player and Flowplayer, can “seek” in the truest sense of the word.

Posted: Thursday Jun 7th, 2012 at 8:44 pm #15872
Staff Member
If all you need to do is set Accept-Ranges: bytes,
you can also make a direct edit to this file: /s2member/includes/classes/files-in.inc.php
Search for Accept-Ranges:
Posted: Thursday Jun 7th, 2012 at 9:49 pm #15880

Jason, thank you very much for the replies. If nothing else, they at least give me the ability to start experimenting. It’s somewhat hard to believe that in 2012 serving audio is still so complicated and without consistent support across browsers, but it is what it is.

I am aware of S3, CloudFront, and RTMP and have had them working on an experimental level in the past. However, the project I’m now working on is an extremely low-budget affair (really just a side project / hobby that might someday turn into more) and at this point I’d prefer to avoid the additional cost.

The other issue is that RTMP is Flash-only, and I really want to support HTML5 for a variety of reasons. Of course HTML5 doesn’t offer the same level of security that Flash/RTMP do, hence the attractiveness of s2Member and a modified plan for access via a combination of download counts, obfuscation, etc.

If it’s possible to include support for byte-range requests in the next version, I would greatly appreciate it… it would be a great feature. Being more advanced in nature, perhaps it could be accessible via s2-hacks.php or a similar method.

Posted: Thursday Jan 17th, 2013 at 6:59 am #37871
Staff Member
UPDATE: Byte-range requests are now supported by s2Member, starting with v130116.
See: http://www.s2member.com/changelog/#s2-changes-v130116

Thanks for your patience.

Viewing 7 replies - 1 through 7 (of 7 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WordPress.org. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.