I'm attempting to use signed cookies to access private content on AWS Cloudfront.
- Rails 4.2.1 app running in development on Puma server - http://localhost:3000
- Using latest Chrome (and can reproduce same in Firefox and Safari)
My app successfully sets the correct cookies required by cloudfront, and each cookie has the correct value. For reference, the three cookies that need to be set are:
- CloudFront-Policy
- CloudFront-Signature
- CloudFront-Key-Pair-Id
I know that the values are correct as if I grab those cookies and perform a curl request using them, it is successful (values replaced with ... for the sake of brevity):
curl -v -b "CloudFront-Signature=...; CloudFront-Policy==...; CloudFront-Key-Pair-Id==...;" http://mydistribution.cloudfront.net/myfile.jpg
The fault
When I use the browser, whilst I can see the cookies have been set in my original request to the server http://localhost:3000/, my requests to Cloudfront urls (for example, in my image tags) do not pass on any of these cookies. This results in
<Error><Code>MissingKey</Code><Message>Missing Key-Pair-Id query parameter or cookie value</Message></Error>
Any ideas why my cookies are not being sent to cloudfront? Advice and support appreciated :)