latest stable versions: v150827 (changelog)

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

Amazon S3 Directory structure

Home Forums Community Forum Amazon S3 Directory structure

This topic contains 8 replies, has 2 voices. Last updated by  Laurent Bertin 3 years, 11 months ago.

Topic Author Topic
Posted: Tuesday Jan 22nd, 2013 at 5:51 pm #39010

Hello,

I’ve configured S2Member Pro with Amazon S3 and Cloudfront and it’s working but I don’t understand something.

On my S3 Bucket, do I need to add a structure like access-s2member-ccap-xxx somewhere ? That’s what I did and in the RMTP php/javascript shortcode I just say that the file is access-s2member-ccap-xxx/myfile.mp4

Is that enough for using custom capabilities ? I’m not sure I’m doing this the good way, since it misses all I had before like /wp-content/xxx/s2member-files/…/ and all the rewrite URL I used.

The question is : what directory structure (if needed) should be on Amazon S3 and can I call directly the directory structure of Amazon S3 (as I did) without worrying at all about the MOD Rewrite ?

Regards,

List Of Topic Replies

Viewing 8 replies - 1 through 8 (of 8 total)
Author Replies
Author Replies
Posted: Thursday Jan 24th, 2013 at 2:56 am #39300
Staff Member

Thanks for your inquiry. ~ We appreciate your patience :-)

The question is : what directory structure (if needed) should be on Amazon S3 and can I call directly the directory structure of Amazon S3 (as I did) without worrying at all about the MOD Rewrite ?

Yes, the directory structure is the same, the way you link to files is same too. You can still use s2Member’s Mod Rewrite functionality if you like. If you’ve been using Custom Capabilities to protect files with sub-directories, you will simply mirror that directory structure in your S3 Bucket please.

So for instance, if I have an audio file that requires the “music” Capability, I might have it here.

BUCKET: /access-s2member-ccap-music/audio.mp3

You would link to that file like this (taking advantage of s2Member’s Mod Rewrite functionality).

http://www.example.com/wp-content/plugins/s2member-files/access-s2member-ccap-music/audio.mp3

The file is served from your S3 Bucket, but your on-site links remain the same.

Of course, if you’re streaming audio/video, you can just use the new [s2Stream /] shortcode if you like.
See: Knowledge Base » JW Player® w/ [s2Stream /] Shortcodes


For the benefit of other readers, we’re discussing File Downloads protected by Custom Capabilities.
See: Dashboard -› s2Member® -› API / Scripting -› Custom Capability and Member Level Files

Posted: Thursday Jan 24th, 2013 at 3:00 am #39301

Thanks for the answer,

I’m linking to the files like this : /access-s2member-ccap-music/audio.mp3, is that ok too or do I have to do has you did with http://xxxx/access-s2member-ccap-music/audio.mp3 ?

Regards,

Posted: Thursday Jan 24th, 2013 at 5:09 am #39338
Staff Member

Yes, that’s fine too :-)

Posted: Thursday Jan 24th, 2013 at 5:13 am #39340

I’ve just tested the security of the files and when I look into the page code and grab the URL of the Amazon S3 BUcket with all the parameters S2 Members adds, I can still look at the video, even when logged off. What did I miss ?

Thanks

Posted: Thursday Jan 24th, 2013 at 5:46 am #39351
Staff Member

Thanks for your reply :-)

I’ve just tested the security of the files and when I look into the page code and grab the URL of the Amazon S3 BUcket with all the parameters S2 Members adds, I can still look at the video, even when logged off. What did I miss ?

If you’re referring to the source location of the file at Amazon S3, those links expire after 24 hours automatically.

Please read the dev notes in this section of your Dashboard.
See: Dashboard -› s2Member® -› Download Options -› Amazon® S3/CDN Storage
The expiration of 24 hours can also be modified if you like.

It won’t matter if you’re logged in or not, the source location at Amazon S3 is acquired through a digitally signed URL. Once that digitally signed URL is generated for an authenticated User/Member, access remains for up to 24 hours (for anyone that has the link that was generated for them).

If CloudFront is integrated as well, the same is true. Except, only the original IP address that was authenticated will continue to have access for the 24 hour period, because CloudFront makes it possible for s2Member® to limit this to a specific IP address. Amazon S3 alone does not make this possible.

Download Options -› Amazon® S3/CDN Storage
Dev Note w/Technical Details: s2Member uses “Digitally Signed URLs”, authenticated by the Amazon® S3 API. Documented for developers here. To put it simply, s2Member will generate Amazon® S3 URLs ( internally ); which allow Customers temporary access to specific files inside your S3 Bucket. s2Member’s Digitally Signed URLs leading to Amazon® S3, give a Customer 24 hours to connect to the file inside your S3 Bucket. This connection period of 24 hours is largely irrelevant when used in combination with s2Member, because access is renewed for another 24 hours each time you make a file available to a User/Member, and they are authenticated by your configuration of s2Member. This connection period of 24 hours is just a secondary line of defense to further prevent the possibility of link sharing. If you need to change this connection timeout of 24 hours for some reason ( not likely ), you can use this WordPress® Filter: ws_plugin__s2member_amazon_s3_file_expires_time.

Please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
(NOTE: these are MUST USE plugins, see: http://codex.wordpress.org/Must_Use_Plugins)
(See also: http://www.s2member.com/kb/hacking-s2member/)

Posted: Thursday Jan 24th, 2013 at 5:49 am #39352

Thanks again, really great support here. I was just looking into all those documentations while you replied. Reading your post and that documentation, that raised a question :

If my video is 2 hours long and if i restrict the URL to 30 Minutes, will that cut off the video at 30 minutes ? Or the 30 minutes are the starting of the file access.

Regards,

Posted: Thursday Jan 24th, 2013 at 5:54 am #39354
Staff Member

If my video is 2 hours long and if i restrict the URL to 30 Minutes, will that cut off the video at 30 minutes ? Or the 30 minutes are the starting of the file access.

It’s normally fine. Once a download begins (as long as it begins within 30 minutes), it won’t matter how long it takes the file to download. However, some devices will use byte-range requests, which s2Member now supports. Thus, an expiration time of 24 hours will provide the best customer experience and fewer complaints from mobile devices and/or tablets.

Posted: Thursday Jan 24th, 2013 at 6:26 am #39372

Thanks for your answers, I now understand this very well and it’s working as intended. Thanks a lot.

While you are around I started another thread not S2Member related, just asking the tool you use for doing your video tutorials which I find really great.

http://www.s2member.com/forums/topic/not-directly-s2member-related/

Thanks again for the great support,

Viewing 8 replies - 1 through 8 (of 8 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 WP Sharks™. 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.