Skip to content

Commit

Permalink
Bug: Cloudfront "Stream ID Not Found" when IP Changes; see: #791
Browse files Browse the repository at this point in the history
  • Loading branch information
renzms committed Jan 29, 2016
1 parent 0ad3b65 commit f7854a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions s2member/includes/classes/files-in.inc.php
Expand Up @@ -997,8 +997,7 @@ public static function amazon_cf_url($file = '', $stream = FALSE, $inline = FALS
$cfc['expires'] = strtotime('+'.apply_filters('ws_plugin__s2member_amazon_cf_file_expires_time', '24 hours', get_defined_vars()));

$cf_extn = strtolower(substr($file, strrpos($file, '.') + 1)); // Parses the file extension out so we can scan it in some special scenarios.
$cf_ip_res = (c_ws_plugin__s2member_utils_conds::is_localhost()) ? FALSE : TRUE; // Do NOT restrict access to a particular IP during `localhost` development. The IP may NOT be the same one Amazon CloudFront sees.
$cf_stream_extn_resource_exclusions = array_unique((array)apply_filters('ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions', array('mp3'), get_defined_vars())); // MP3 files should NOT include an extension in their resource reference.
$cf_ip_res = c_ws_plugin__s2member_utils_conds::is_localhost() || ($stream && !$cfc['rtmp_policy_include_ip']) ? FALSE : TRUE;

This comment has been minimized.

Copy link
@jaswrks

jaswrks Jan 29, 2016

Contributor

@renzms Can you please fix the indentation here? Thanks! :-)

$cf_resource = ($stream) ? ((in_array($cf_extn, $cf_stream_extn_resource_exclusions)) ? substr($file, 0, strrpos($file, '.')) : $file) : 'http'.(($ssl) ? 's' : '').'://'.(($cfc['distro_downloads_cname']) ? $cfc['distro_downloads_cname'] : $cfc['distro_downloads_dname']).'/'.$url_e_file;
$cf_url = ($stream) ? 'rtmp'.(($ssl) ? 'e' : '').'://'.(($cfc['distro_streaming_cname']) ? $cfc['distro_streaming_cname'] : $cfc['distro_streaming_dname']).'/cfx/st/'.$file : 'http'.(($ssl) ? 's' : '').'://'.(($cfc['distro_downloads_cname']) ? $cfc['distro_downloads_cname'] : $cfc['distro_downloads_dname']).'/'.$url_e_file;
$cf_policy = '{"Statement":[{"Resource":"'.c_ws_plugin__s2member_utils_strings::esc_dq($cf_resource).'","Condition":{'.(($cf_ip_res) ? '"IpAddress":{"AWS:SourceIp":"'.c_ws_plugin__s2member_utils_strings::esc_dq($_SERVER['REMOTE_ADDR']).'/32"},' : '').'"DateLessThan":{"AWS:EpochTime":'.(int)$cfc['expires'].'}}}]}';
Expand Down
1 change: 1 addition & 0 deletions s2member/includes/syscon.inc.php
Expand Up @@ -321,6 +321,7 @@ function ws_plugin__s2member_configure_options_and_their_defaults($options = FAL
$default_options['amazon_cf_files_distro_streaming_cname'] = '';
$default_options['amazon_cf_files_distro_streaming_dname'] = '';
$default_options['amazon_cf_files_distros_auto_config_status'] = '';
$default_options['amazon_cf_files_rtmp_policy_include_ip'] = '1';

This comment has been minimized.

Copy link
@jaswrks

jaswrks Jan 29, 2016

Contributor

@renzms Please add some spaces to align the equals signs here.


$default_options['ruris_case_sensitive'] = '0'; // No by default.

Expand Down

0 comments on commit f7854a8

Please sign in to comment.