Is using a CDN possible when you're running a

2019-03-22 15:36发布

问题:

I have a website with only home page available through simple HTTP protocol. All other pages are accessible only through HTTP over SSL(https://).

I'm using CDN for home page and very happy with it.

But for me it looks like using CDN for https pages is impossible because of security warnings, especially in IE. My files hosted at CDN are accessible though simple HTTP protocol.

What should I do? How this problem can be solved?

回答1:

You need to get a CDN that supports serving files over HTTPS, then use that CDN for the SSL requests.



回答2:

You can do this if their boxes have HTTPS support. What you can't do is use a subdomain of your own domain to cname against the cdn network. Because SSL doesn't work this way.

so https://cdn.tld/mydomain/path/to/file as a mechanism does work (because browsers will verify the cdn.tld ssl certificate correctly)

but https://cdn.mydomain.tld/path/to/file will not.



回答3:

Two options, but in general I'd redirect all pages that don't need to be SSL'ed to their non-SSL equivalent and only use SSL when necessary.

  1. Get a SSL certificate for your CDN host. It's just 30 bucks/year, but you need to take into account that this requires more configuration and depending on the traffic, this is also more expensive because the server requires more resources for SSL'd connections.

  2. For the relevant pages, store the CSS/images/js files "local" on your own SSL host and use them when you need SSL. Of course you loose the speed etc. from the CDN, but that's a trade off. We opted for this because just our signup is SSL, 99.9999% of the time users spend on our website is on non-SSL links.