How to reduce the expiry time for S3 Amazon?

I am using S3 Amazon with S2member. I want to reduce the timeout for S3 Amazon generated links. What is the best way to do that?

Interested in the answer to this question…

1 Like

See the documentation here: WP Admin > s2Member > Download Options > Amazon S3/CDB > Dev Note w/ Technical Details

“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.”

So you’d do something similar to this: http://web.archive.org/web/20120718101354/http://www.s2member.com/forums/topic/jw-cf-expiry/#post-15970

Create this directory and file: /wp-content/mu-plugins/s2-hacks.php
(See: http://codex.wordpress.org/Must_Use_Plugins)

<?php
add_filter('ws_plugin__s2member_amazon_s3_file_expires_time', 'my_s3_expiration_time');
function my_s3_expiration_time($default) {
	// Anything compatible with PHP's strtotime() function.
	// https://www.php.net/manual/en/datetime.formats.time.php
	return '12 hours';
}

I hope that helps! :slight_smile: