Here's a weird behaviour I'm having when trying to use a custom origin and HTTPS.
I make the file available and check that it works on
http://mydomain/file.css and
https://mydomain/file.css
Great, now I can try to pick them up via Cloudfront so I create a distribution and wait till it's deployed. Now, replace my domain in
https://mydomain/file.css with the domain from Cloudfront. I.e.
https://xyz123.cloudfront.net/file.css and load it. (Note that I'm testing the https URL first)
But! This gives me a 503 error from cloudfront with the message "The request could not be satisfied".
As I'm doing this I'm keeping a close eye on my Nginx log files on the custom origin. Nothing happens. I.e. Cloudfront is NOT even attempting to pick it up from my custom origin.
Right, let's try the http URL instead. I instead load:
http://xyz123.cloudfront.net/file.css
It works! I see in my Nginx logs that it picked it up. Reloading again and it's clear that it now uses Cloudfront instead because it's not picked up a second time from Nginx.
Lastly, I now go back to the https URL that failed before. I load:
https://xyz123.cloudfront.net/file.css
Now it works!!!
This is obviously annoying that I have to load its HTTP URL before I can load its HTTPS URL.
I suspect that the problem is that Cloudfront can't fetch it from me via HTTPS.
Does that mean that HTTPS + Custom origin doesn't work?
At the moment I'm just doing HTTPS on my images, CSS and JS because my HTML is HTTPS and I don't want one of those warning messages saying the webpage is using some "insecure" stuff. (I don't care personally but my users will)