Whether HTTP and HTTPS work at all depends on your hosting provider. Almost all hosting providers provide a HTTP version of a site, but not all providers support HTTPS. If you try to connect to https://yoursite.com/ you may get an error message:
- "Connection refused" indicates that the server does not support HTTPS at all. Your browser tries to connect on port 443, but the server does not accept connections on that port.
- "Your connection is not secure" indicates that the server does support HTTPS, but it does not provide the correct certificate for your site.
Sites that support HTTPS may want users to always use the HTTPS version, and never the HTTP version. There are some ways to ensure this:
- If the user connects to HTTP, immediately redirect them to the HTTPS version.
- On the HTTPS version, respond with a Strict-Transport-Security header to indicate that HTTPS should be used from now on.