{"action":"created","issue":{"url":"https://api.github.com/repos/websharks/s2member/issues/731","labels_url":"https://api.github.com/repos/websharks/s2member/issues/731/labels{/name}","comments_url":"https://api.github.com/repos/websharks/s2member/issues/731/comments","events_url":"https://api.github.com/repos/websharks/s2member/issues/731/events","html_url":"https://github.com/websharks/s2member/issues/731","id":107092307,"number":731,"title":"Bug: s2Stream Error: \"Stream ID Not Found\"","user":{"login":"renzms","id":13220018,"avatar_url":"https://avatars.githubusercontent.com/u/13220018?v=3","gravatar_id":"","url":"https://api.github.com/users/renzms","html_url":"https://github.com/renzms","followers_url":"https://api.github.com/users/renzms/followers","following_url":"https://api.github.com/users/renzms/following{/other_user}","gists_url":"https://api.github.com/users/renzms/gists{/gist_id}","starred_url":"https://api.github.com/users/renzms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renzms/subscriptions","organizations_url":"https://api.github.com/users/renzms/orgs","repos_url":"https://api.github.com/users/renzms/repos","events_url":"https://api.github.com/users/renzms/events{/privacy}","received_events_url":"https://api.github.com/users/renzms/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/websharks/s2member/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/websharks/s2member/labels/high%20priority","name":"high priority","color":"e11d21"},{"url":"https://api.github.com/repos/websharks/s2member/labels/tested/reproduced","name":"tested/reproduced","color":"207de5"},{"url":"https://api.github.com/repos/websharks/s2member/labels/working","name":"working","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-09-17T22:51:40Z","updated_at":"2015-11-20T01:46:36Z","closed_at":null,"body":"## Overview ##\r\n\r\nThere is an error message after trying to set up an Amazon CloudFront integration with s2Member v150827. Also, when embedding files for streaming/access/ or download, the file does not appear as intended.\r\n\r\n## Steps to Reproduce ##\r\n\r\n* Follow steps in [Amazon S3 + Amazon CloudFront (CDN + Media Server)](http://s2member.com/kb-article/amazon-s3cloudfront/) video.\r\n * set up Amazon account\r\n * set up bucket\r\n * integrate with Amazon S3 s2Member\r\n*  At Amazon S3 + Amazon CloudFront (CDN + Media Server) step, setup as usual and generate Key Pair ID, (Private Key, Public Key) and Access Key.\r\n* Plug in corresponding Access Key into field\r\n * Paste Private key text in Atom/text editor\r\n * Copy all text and paste into Private Key field\r\n* Save all configurations\r\n\r\nAdditional Steps\r\n* Upload a file in bucket.\r\n* Add link in similar format as video tutorial\r\n* Save page and try to access the file/media\r\n\r\n## Expected Behavior ##\r\n\r\nA success message along the lines of:\r\n\r\n```\r\nOptions Saved.\r\n\r\nAmazon CloudFront distributions configured successfully.\r\n```\r\n\r\nFor pages that have content media, items should display successfully to be streamed/access or downloaded.\r\n\r\n## Observed Behavior ##\r\n\r\nError message prompt.\r\n\r\n```\r\nUnable to auto-configure Amazon CloudFront Distributions.\r\nError code: 503. Error Message: Unable to create Amazon CloudFront Downloads Distro. Unable to create Amazon CloudFront Downloads Distro. Service Unavailable\r\n```\r\n\r\nor\r\n\r\nin some user cases\r\n```\r\nUnable to auto-configure Amazon CloudFront Distributions. \r\nError code: 400. Error Message: Unable to create Amazon CloudFront Origin Access Identity. Unable to create Amazon CloudFront Origin Access Identity. Bad Request\r\n\r\n```\r\n\r\n\r\nFor Content Media files the following error is displayed:\r\n\r\n```\r\nThis XML file does not appear to have any style information associated with it. The document tree is shown below. \r\n<Error> \r\n<Code>SignatureDoesNotMatch</Code> \r\n<Message> \r\nThe request signature we calculated does not match the signature you provided. Check your key and signing method. \r\n</Message> \r\n<AWSAccessKeyId>AKIAJ6MLVX3TQZD4NNBA</AWSAccessKeyId> \r\n<StringToSign> \r\nAWS4-HMAC-SHA256 20150903T190224Z 20150903/us-east-1/s3/aws4_request dbe6c42b52143adf96a79d9b92b85c292c4feccdb9940d96f00cf6d2abeee5cb \r\n</StringToSign> \r\n<SignatureProvided> \r\ne33a1cb21d6a5c4a9dcdc60faf59644586dff85199d5180b46d941ab0d6876ce \r\n</SignatureProvided> \r\n<StringToSignBytes> \r\n41 57 53 34 2d 4\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/websharks/s2member/issues/comments/158255309","html_url":"https://github.com/websharks/s2member/issues/731#issuecomment-158255309","issue_url":"https://api.github.com/repos/websharks/s2member/issues/731","id":158255309,"user":{"login":"jaswsinc","id":1563559,"avatar_url":"https://avatars.githubusercontent.com/u/1563559?v=3","gravatar_id":"","url":"https://api.github.com/users/jaswsinc","html_url":"https://github.com/jaswsinc","followers_url":"https://api.github.com/users/jaswsinc/followers","following_url":"https://api.github.com/users/jaswsinc/following{/other_user}","gists_url":"https://api.github.com/users/jaswsinc/gists{/gist_id}","starred_url":"https://api.github.com/users/jaswsinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaswsinc/subscriptions","organizations_url":"https://api.github.com/users/jaswsinc/orgs","repos_url":"https://api.github.com/users/jaswsinc/repos","events_url":"https://api.github.com/users/jaswsinc/events{/privacy}","received_events_url":"https://api.github.com/users/jaswsinc/received_events","type":"User","site_admin":false},"created_at":"2015-11-20T01:46:36Z","updated_at":"2015-11-20T01:46:36Z","body":"## Debugging Phase (Cont.)\r\n\r\nAfter several hours of testing and Cloudfront logging, I switched ISPs (I have two), and it worked like a charm on an alternate ISP (sigh). Further testing shows that a \"Stream ID Not Found\" error can be caused by a change in IP address.\r\n\r\nThe digitally signed URLs produced by s2Member are always connected to the current authenticated user's IP address, which makes it impossible for them to share the URL with others. In addition, the URL is digitally signed, and will expire after 24 hours anyway; i.e., good for 24 hours each time they load the player. This prevents the underlying `rtmp://` from being shared in ways that would allow the rest of the world to view them for any length of time.\r\n\r\nWhat I experienced (Stream ID Not Found) was caused by my ISP. My IP address changes from one protocol to another sometimes. Over `http://` (the CloudFront link was signed), but then whenever JW Player tried to load the file over `rtmp://` my IP address was different when it got passed to Cloudfront, causing the \"Stream ID Not Found\" error, because I failed authentication.\r\n\r\n## Short-Term Workaround\r\n\r\nDisable IP restrictions until we can improve this somehow.\r\n\r\nIn [this line](https://github.com/websharks/s2member/blob/150925/s2member/includes/classes/files-in.inc.php#L1000) change `TRUE` to `FALSE`.\r\n\r\n```php\r\n$cf_ip_res = (c_ws_plugin__s2member_utils_conds::is_localhost()) ? FALSE : FALSE;\r\n```\r\n\r\n## Developer Tip\r\n\r\nThere is a nifty command-line tool available via Homebrew on a Mac that helped me find this bug.\r\n\r\n```bash\r\n$ brew install rtmpdump\r\n```\r\n\r\nExample usage:\r\n\r\n```bash\r\n$ rtmpdump -r 'URL to rtmp:// file' -o ~/temp/test.mp4\r\n```"}}