liveBook · Manning

HTTPS

As explained in ASP.NET Core in Action, 3e

HTTPS is HTTP secured with Transport Layer Security to provide encrypted and authenticated communication.

HTTPS protects communication between a client and an application by encrypting HTTP requests and responses with TLS. Without it, attackers on the same network can read or modify traffic, steal cookies, or expose passwords and personal information. HTTPS is effectively required for production applications. section 28.1 section 28.5

Choose the HTTPS arrangement that fits the application:

  • Use the ASP.NET Core development certificate, or the IIS Express development certificate, for local testing. Trust the certificate with dotnet dev-certs https --trust. section 28.0 section 28.5
  • Configure Kestrel with a production certificate through Kestrel:Certificates:Default. Kestrel loads it at startup without application code changes. section 28.0 section 28.5
  • Terminate TLS at a reverse proxy such as IIS, NGINX, or a third-party service, or pass encrypted traffic through to the application. section 28.1 section 28.5
  • Encourage browser clients to use HTTPS with HTTP-to-HTTPS redirection and HSTS. API applications should generally listen only for HTTPS because non-browser clients may not follow browser protections. section 28.4 section 28.4.3

HTTPS-only API endpoint

Configure the application URL with only an HTTPS address, such as ASPNETCORE_URLS=https://*:5001. The application then listens on port 5001 for HTTPS connections and does not handle HTTP requests. section 28.4.3

Figure 28.1 Unencrypted HTTP requests can be read by users on the same network. Attackers can even intercept the request and response, reading or changing the data. HTTPS requests can’t be read or manipulated by attackers.
CH28_F01_Lock3

Use the traffic comparison to see why unencrypted HTTP permits reading and manipulation while HTTPS protects requests and responses. section 28.1

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains traffic risks, certificates, Kestrel configuration, reverse-proxy termination, redirection, HSTS, and HTTPS-only APIs, but defers protocol internals.
Examples
Demonstrates development certificates, Kestrel certificate configuration, reverse-proxy termination, HSTS, redirection, and an HTTPS-only ASPNETCORE_URLS setting.
What it assumes
Assumes familiarity with HTTP requests, responses, headers, bodies, and browser-to-application communication.
What you can do after
Operate/configure HTTPS locally with a trusted certificate, configure production Kestrel, or enforce HTTPS for an ASP.NET Core application.
How it connects
Connects HTTPS with HTTP, TLS certificates, Kestrel, reverse proxies, HSTS, HTTP/2, HTTP/3, and security headers.

Also explained in

Compare how 7 books explain HTTPS →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.