Question

I have some ASPX pages on my IIS. They are available both via HTTP and HTTPS. The public pages are the same, regardless of http or https protocol. Now, according to (not only) Googles Best Practices, I want to serve my static files from a cookieless domain. Therefore I registered a completely new domain name, e.g. mystaticdomain.com . But how do I reference the images? Actually I can think of several options:

  1. Using http://mystaticdomain.com would throw warnings if someone accesses my homepage using https
  2. Using always https://mystaticdomain.com would add additional overhead due to the https connection even if someone accesses my homepage using http
  3. In the backend I could check the protocol and then compute the link to the images based on the used protocol.
  4. Use different homepages for http and https

All of these options have some disadvantages so I wonder what is the preferred way? Thanks in advance!

Était-ce utile?

La solution

You could also use protocol-relative URLs: eg. <img src="//mystaticdomain.com/foo.png">. For more info, see: http://www.paulirish.com/2010/the-protocol-relative-url/

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top