title: setting up signed cookies for aws cloudfront https with php SDK
body: <p>I am setting up a HLS streaming service through cloudfront and implementing several security measures for content protection. I have successfully made it work under http, I can stream video and watch it in my website with a lot of content protection security measures.  For more details on how I managed to make it work for http you can consult it in a post I made in drupal.org about <a href="https://www.drupal.org/node/2672400" rel="noreferrer">secure hls streaming</a>.</p>
  
  <p>But now I need to add https to the formula because some encryption keys for hls encrypted segments are being transmitted, but I am having problems. Now I am working to add https to the formula. I have added a certificate to my site and I have added a different certificate in cludfront because my certificate is not a wildcard one.</p>
  
  <p>My site certificate works for subdomain.mydomain.com</p>
  
  <p>My cloudfront certificate is for *.mydomain.com</p>
  
  <p>My cloudfront distribution has a cname of cdn.mydomain.com</p>
  
  <p>When I create the cookie I set the secure parameter to true in the call (6th parameter after domain):</p>
  
  <pre><code>setcookie($name, $value, strtotime('+1 hour'), "/", ".mydomain.com", true, true);
  </code></pre>
  
  <p>But when I try to access some test data in my site</p>
  
  <pre><code>if (readfile('https://cdn.mydomain.com/privacy_test.txt')==0)
      print "Error in cdn access";
  </code></pre>
  
  <p>I don't see the contents of the file in my website, but the error message.</p>
  
  <p>So it seems I need more things to do to make cloudfront aws signed cookies work under https. Any help?</p>