(I had a hard time deciding where this needs to go: sever room forum? After all, it's about a web server. Networking forum? These are network protocols. But I landed here as HTML is explicitly on topic.)
So I decided to give in to peer pressure and finally enable HTTPS on my websites. These days, that's free and super easy with Let's Encrypt and certbot.
But now the conundrum: how do I handle the coexistence of HTTPS and HTTP? One reason I avoided HTTPS for so long is that it's another thing that can fail, and something that's only partially under my own control. So for that reason, I want everything to keep working as before over HTTP.
I have a bunch of subdomains for different areas of interest, but in order to not displease the web indexing gods, I always point to a single canonical location for each page, so many links aren't relative links, but they have the domain name in them. Turns out you can have protocol-relative URLs like //www.iljitsch.com/2020/keyboardtest/ (might as well plug my Javascript keyboard tester) so on an HTTP page this will be an HTTP link and on an HTTPS page an HTTPS link. This seems to be frowned upon these days because it's not enforcing all HTTPS all of the time, but other than that this should be fine, I think.
However, the web indexing gods are a fickle bunch, and they don't like duplicate content. You can avoid that by declaring one page canonical. So it might make sense to declare the HTTPS page canonical. But there's warnings all over the web against having the HTTP page declaring the HTTPS page canonical. I really don't understand that, what am I missing?
For dynamic content I might use a noindex meta tag on the HTTP version so Google and friends will ignore the HTTP version and just index the HTTPS version. However, most content is static so then that won't work.
One thing I learned as I was doing this: browsers (well, Safari and Chrome) no longer seem to care too much if you have HTTP elements on an HTTPS page, if those come from the same domain. The only thing that happens in this case is that you don't get the lock in the URL bar, but you also don't get the "not secure" warning that you get with HTTP pages.
If anyone has additional suggestions about handling HTTPS and HTTP I'm all ears.
So I decided to give in to peer pressure and finally enable HTTPS on my websites. These days, that's free and super easy with Let's Encrypt and certbot.
But now the conundrum: how do I handle the coexistence of HTTPS and HTTP? One reason I avoided HTTPS for so long is that it's another thing that can fail, and something that's only partially under my own control. So for that reason, I want everything to keep working as before over HTTP.
I have a bunch of subdomains for different areas of interest, but in order to not displease the web indexing gods, I always point to a single canonical location for each page, so many links aren't relative links, but they have the domain name in them. Turns out you can have protocol-relative URLs like //www.iljitsch.com/2020/keyboardtest/ (might as well plug my Javascript keyboard tester) so on an HTTP page this will be an HTTP link and on an HTTPS page an HTTPS link. This seems to be frowned upon these days because it's not enforcing all HTTPS all of the time, but other than that this should be fine, I think.
However, the web indexing gods are a fickle bunch, and they don't like duplicate content. You can avoid that by declaring one page canonical. So it might make sense to declare the HTTPS page canonical. But there's warnings all over the web against having the HTTP page declaring the HTTPS page canonical. I really don't understand that, what am I missing?
For dynamic content I might use a noindex meta tag on the HTTP version so Google and friends will ignore the HTTP version and just index the HTTPS version. However, most content is static so then that won't work.
One thing I learned as I was doing this: browsers (well, Safari and Chrome) no longer seem to care too much if you have HTTP elements on an HTTPS page, if those come from the same domain. The only thing that happens in this case is that you don't get the lock in the URL bar, but you also don't get the "not secure" warning that you get with HTTP pages.
If anyone has additional suggestions about handling HTTPS and HTTP I'm all ears.
Pro tip: if you have to do this, run an internal validation before having LE run its validation; cuts way down on error-based throttling when a customer adds a new domain to their site but neglects to buy the domain or point it to the right IP address. Yes, we'll do this for our customers, and I think we just charge them the actual cost of the domain name. Yes, customers still insist on doing it themselves.