Search code examples
sslamazon-web-servicesamazon-cloudfront

Cloudfront in front of an IIS7.5 web server with SSL


I have a CloudFront destro in front of my asp.net application, serving dynamic content. All cache periods are set and everything looks ok.

I am using cloudfront mainly to accelerate the site for international visitors. I have a registration page on the site that uses SSL. I understand that I can't use my own SSL with cloudfront, but is there a way that I can tell cloudfront to point the user to the origin when they navigate to one of the HTTPS pages?


Solution

  • The urls on your secure page must use the https prefix or the browser will complain about mixed-mode content. This means that the requests have to start their lives as https ones. This makes redirection in the manner you suggest impossible.

    Your best bet is to have logic in your pages that determines the host portion of your url and protocol so that if it's a secure connection, all your content urls are prefixed with the secure host/protocol in the form https://[cloudfront-secure-hostname]/[your content]

    If the connection is not secure, you return your standard CDN hostname using http.

    The only down side is that a user will see requests going off to a domain other than yours. This shouldn't be too much of a problem though.