WhichWebHosting home

HomeGuidesSSL and securityWhat is HTTPS?

What is HTTPS?

Published

Share

HTTPS stands for HyperText Transfer Protocol Secure.1, source 1 HTTPS is an encrypted version of the HTTP protocol.1, source 1 It uses TLS to encrypt all communication between a client and a server.1, source 1

How does TLS relate to HTTPS?

TLS (Transport Layer Security) is a protocol that lets a client communicate securely with a server across an untrusted network.2, source 2 TLS is most notably used to secure HTTP connections on the web, and the resulting protocol is called HTTPS.2, source 2 RFC 8446 specifies version 1.3 of the Transport Layer Security (TLS) protocol.3, source 3 TLS allows client/server applications to communicate over the Internet in a way that is designed to prevent eavesdropping, tampering, and message forgery.3, source 3

TLS is application protocol independent, so higher-level protocols can layer on top of it transparently.3, source 3

What does HTTPS protect?

TLS secures a network connection in three ways: encryption, integrity and authentication.2, source 2 With TLS encryption, the data exchanged between client and server is encrypted in transit, so attackers can't read it.2, source 2 With TLS integrity, an attacker can't modify data in transit between client and server without detection.2, source 2 With TLS authentication, client and server can each prove to the other party that they are the entity they claim to be.2, source 2

The server side of a TLS channel is always authenticated, and the client side is optionally authenticated.3, source 3 On the web, clients don't usually authenticate themselves to servers.2, source 2 TLS consists of a handshake protocol, which authenticates the communicating parties, negotiates cryptographic modes and parameters, and establishes shared keying material, and a record protocol, which protects traffic between the peers.3, source 3 After the TLS handshake, client and server use the agreed secret key to encrypt and decrypt any messages, including HTTP headers as well as bodies.2, source 2

In TLS, data sent over the channel after establishment is only visible to the endpoints, although TLS does not hide the length of the data it transmits.3, source 3 TLS is designed so that its authentication, confidentiality and integrity hold even when an attacker has complete control of the network.3, source 3

A manipulator in the middle (MITM) attack intercepts a communication between two systems, for example through a compromised Wi-Fi router.4, source 4 HTTPS is the defense against this attack, in which the attacker inserts themselves between a person's browser and the server and can read and modify the traffic exchanged.2, source 2

Sensitive sites without HTTPS encryption on public Wi-Fi networks aren't trustworthy.4, source 4 Before logging in, check for HTTPS in your address bar and make sure encryption is in place.4, source 4 Certificate warnings should not just be ignored, because you could be connecting to a phishing server or an imposter server.4, source 4

How HTTPS is defined as a URL scheme

RFC 9110 defines the "https" URI scheme.5, source 5 An https URI is written as the scheme "https", then "://", then an authority, a path and an optional query.5, source 5 The origin server for an "https" URI is identified by the authority component, which includes a host identifier and an optional port number.5, source 5 For an "https" URI with no port given, TCP port 443, the reserved port for HTTP over TLS, is the default.5, source 5

A sender must not generate an "https" URI with an empty host identifier, and a recipient that processes such a URI reference must reject it as invalid.5, source 5 The "https" scheme does not rely on TCP and the connected port number for associating authority, since both are outside the secured communication and cannot be trusted as definitive.5, source 5 To reach an "https" resource, a client may resolve the host to an IP address, establish a TCP connection on the indicated port, secure the connection by initiating TLS over TCP, and send an HTTP request over it.5, source 5

A client must ensure that its HTTP requests for an "https" resource are secured before they are communicated, and that it only accepts secured responses to those requests.5, source 5 In RFC 9110, a secured https connection means the server has been authenticated as acting on behalf of the identified authority and all HTTP communication with that server has confidentiality and integrity protection acceptable to both client and server.5, source 5

Why every site needs HTTPS

All websites should serve all their pages and subresources over HTTPS, and implement server authentication.2, source 2 A common misconception is that only websites that handle sensitive communications need HTTPS.6, source 6 An HTTPS connection lets clients safely exchange sensitive data with a server, such as when performing banking activities or online shopping.1, source 1 However, every unprotected HTTP request can potentially reveal information about people's behaviors and identities.6, source 6

HTTPS prevents intruders from passively listening to communications between a website and the people visiting it.6, source 6 It also helps prevent intruders from tampering with communication between a site and the browsers of the people visiting it.6, source 6 Intrusions on unprotected communication can occur at any point in the network, including a person's machine, a Wi-Fi hotspot, or a compromised ISP.6, source 6

Browsers consider pages delivered over HTTPS as providing a secure context.2, source 2 Documents whose resources are delivered from a loopback (local) address can also be secure contexts.7, source 7 Many web APIs and features are accessible only in a secure context.7, source 7

If these web APIs were available to content not delivered over a secure connection, a manipulator in the middle (MITM) attacker would be able to access them.7, source 7

How a site gets HTTPS

To support server authentication, a website must have a digital certificate, which contains a digitally signed copy of the public key that is the counterpart of the website's private key.2, source 2 A digital certificate is a data file that binds a publicly known cryptographic key to an organization.8, source 8 It also binds the website's keys to their domain name, so the browser knows it is connecting to the site it intends to, for example https://example.com.2, source 2 The certificate contains information about an organization, such as the common name, the organization unit, and the location.8, source 8

Digital certificates are most commonly signed by a certificate authority, attesting to the certificate's authenticity.8, source 8 A certificate authority (CA) is an organization that signs digital certificates and their associated public keys, thereby asserting that the contained information and keys are correct.9, source 9 Certificate authorities are the part of the Internet public key infrastructure that allows browsers to verify website identity and securely connect over TLS (thus HTTPS).9, source 9 Web browsers come preloaded with a list of "root certificates", which the browser can use to check that a website certificate was signed by a certificate authority that "chains back" to a root certificate.9, source 9

The browser's check of a certificate ultimately relies on every certificate authority performing adequate identity checks before signing a certificate.9, source 9 When you set up HTTPS on your own server, you generate a certificate signing request (CSR) that embeds your public key and share it with a certificate authority to receive a final certificate or a certificate chain.10, source 10 Different certificate authorities require certificate signing requests to be submitted in different ways, such as through a form on their website or by email.10, source 10

A certificate can map a key to more than one DNS name, including several distinct names or "wildcard" names such as *.example.com.10, source 10 In a wildcard certificate, the wildcard applies to only one DNS label, so a certificate for *.example.com works for foo.example.com but not for foo.bar.example.com.10, source 10

Let's Encrypt is a widely used nonprofit certificate authority that issues free TLS certificates.2, source 2 Websites can use its certificates to enable secure HTTPS connections.11, source 11 It offers Domain Validation (DV) certificates.11, source 11

Default Let's Encrypt certificates are valid for 90 days.11, source 11 Let's Encrypt says the private key is always generated and managed on your own servers, not by Let's Encrypt.11, source 11 The same Let's Encrypt certificate can contain several different names using the Subject Alternative Name (SAN) mechanism.11, source 11 Wildcard certificates from Let's Encrypt must be issued through the DNS-01 challenge.11, source 11

The goal of Let's Encrypt and the ACME protocol is to make it possible to set up an HTTPS server and automatically obtain browser-trusted certificates without any human intervention.12, source 12 With Let's Encrypt, the ACME client first proves to the certificate authority (CA) that the web server controls a domain, and after that it can request or revoke certificates for that domain.12, source 12 The client can prove control of a domain by provisioning a DNS record under the domain or an HTTP resource under a well-known URI on the domain's http:// site.12, source 12 The CA then checks that these challenges have been satisfied from multiple network perspectives.12, source 12

Modern web hosting services support HTTPS for you, either by default or through a configuration setting.2, source 2 When a hosting service supports HTTPS, it is likely to manage your certificate and configure the server on your behalf.2, source 2

Mixed content, redirects and HSTS

If a website loads the main document over HTTPS but loads any of its subresources over HTTP, this is called mixed content.2, source 2 Mixed content is divided into two categories, upgradable content and blockable content, and browsers should automatically upgrade requests for upgradable content from HTTP to HTTPS and block requests for blockable content.13, source 13

Browsers mitigate the risks of mixed content by auto-upgrading image, video, and audio mixed content requests from HTTP to HTTPS, and blocking insecure requests for all other resource types.13, source 13 Mixed content requests that would otherwise be upgraded are blocked if the URL's host is an IP address rather than a domain name.13, source 13 Browsers commonly block mixed downloads by default but inform people of the risk and allow them to keep or discard the download.13, source 13 To avoid mixed content, serve all content from your domain as HTTPS and make all references to resources on your domain relative links or HTTPS links.13, source 13

The upgrade-insecure-requests directive of the Content-Security-Policy header instructs browsers to treat all of a site's insecure URLs as though they had been replaced with secure URLs.14, source 14 This directive does not replace the Strict-Transport-Security header.14, source 14 The Strict-Transport-Security response header, often abbreviated HSTS, informs browsers that the host should only be accessed using HTTPS and that future attempts to use HTTP should automatically be upgraded to HTTPS.15, source 15 A host must send the Strict-Transport-Security header over HTTPS only, and browsers ignore the header if it is sent over insecure HTTP.15, source 15

HSTS does not take effect until the browser has made at least one secure connection to the host and received the Strict-Transport-Security header.15, source 15 When an HTTPS response includes the Strict-Transport-Security header, the browser adds the host's domain name to its persistent list of HSTS hosts.15, source 15 Before loading an http URL for an HSTS host, the browser replaces the URL scheme with https, and changes an explicit port 80 to 443.15, source 15 If a TLS error such as an invalid certificate occurs when connecting to an HSTS host, the browser does not offer a person a way to click through the error.15, source 15

A host accepting insecure HTTP requests should respond with a permanent redirect, such as status code 301, with an https URL in the Location header.15, source 15

Common questions

What does HTTPS stand for?

It stands for HyperText Transfer Protocol Secure. HTTPS uses TLS to encrypt all communication between a client and a server.

Is HTTPS the same as HTTP?

No, HTTPS is an encrypted version of HTTP. It uses TLS, which secures a connection through encryption, integrity and authentication.

What is the default port for HTTPS?

TCP port 443 is the default port. It is the port reserved for HTTP over TLS, and it is used whenever an https URI gives no port number.

Do I need a certificate for HTTPS?

Yes, a site needs a digital certificate to support server authentication. The certificate binds the website's keys to their domain name.

Does every website need HTTPS?

Yes, every website should serve all pages over HTTPS. Unprotected HTTP requests can reveal information about people's behaviors and identities, and many web APIs only work in a secure context.

Sources

Every fact on this page comes from one of these, checked before it goes live.

More guides

SSL and security

What is a DDoS attack?

A DDoS attack uses many machines to flood one target with traffic until it cannot respond. Learn how it works, the main types and how to reduce the damage.

· Mateo Cardenas

SSL and security

What is a firewall and how does it work?

A firewall controls the flow of network traffic between networks or hosts. Learn how it filters packets, its hardware and software forms, and what WAFs do.

· Mateo Cardenas

SSL and security

What is an SSL certificate?

An SSL certificate binds a public key to a domain name so browsers can verify the server. Learn what it holds, who issues it and how long it lasts.

· Mateo Cardenas

SSL and security

What is TLS?

TLS lets a client communicate securely with a server over an untrusted network, and SSL is its precursor. Learn how it works and which versions to avoid.

· Mateo Cardenas