Certificate revocation checking (via CRL - Certificate Revocation Lists, or the more efficient OCSP - Online Certificate Status Protocol) verifies a certificate hasn't been revoked by its issuing CA before its natural expiration (e.g., due to a private key compromise) -- OCSP stapling has the server periodically fetch and cache its own revocation status from the CA, then include ('staple') that proof directly in the TLS handshake, avoiding the client needing to make its own separate, latency-adding OCSP query to the CA for every connection, which OS-level TLS stacks (schannel, OpenSSL) largely handle automatically as of modern .NET versions, though explicit configuration/monitoring is still a production concern.
# OCSP stapling is largely handled by the underlying OS/TLS library automatically,
# but reverse proxies like nginx can be explicitly configured:
server {
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/ssl/chain.pem;
}
Real-world example
A security team investigating a suspected private key compromise immediately revokes the affected certificate through their CA, relying on OCSP checking (enabled at their nginx reverse proxy layer) to ensure clients reject the compromised certificate promptly rather than continuing to trust it until its natural expiration date months later.
Likely follow-ups
What's the performance and reliability trade-off between OCSP stapling and traditional CRL-based revocation checking?
What happens to client connections if an OCSP responder itself becomes unreachable ('soft-fail' versus 'hard-fail' behavior)?
Tools like openssl s_client (command-line inspection of the certificate chain and negotiated protocol), online scanners like SSL Labs' SSL Test (comprehensive automated grading of TLS configuration, protocol support, and known vulnerabilities), or curl -I to inspect response headers (confirming Strict-Transport-Security is present) all provide independent verification that the deployed HTTPS configuration matches what was intended, catching misconfigurations before they become a production incident or failed security audit.
# Inspect the certificate and negotiated protocol directly
openssl s_client -connect api.example.com:443 -tls1_2
# Verify the HSTS header is present
curl -I https://api.example.com | grep -i strict-transport-security
# Or use an online tool: https://www.ssllabs.com/ssltest/
Real-world example
Before marking a production HTTPS deployment complete, a team runs their domain through SSL Labs' SSL Test, catching that TLS 1.0 was still unexpectedly enabled at the load balancer layer (despite being explicitly disabled in the application's own Kestrel configuration), tracing the actual misconfiguration to infrastructure outside the application itself.
Likely follow-ups
How would you incorporate this kind of TLS configuration verification into an automated CI/CD deployment pipeline?
What specific grade/criteria should a production API's SSL Labs score meet before going live?
The public key (embedded in the certificate itself, freely shared with anyone) is used by clients to encrypt data or verify signatures, while the private key (kept secret, never shared) is used by the server to decrypt that data or create signatures -- if a private key is ever exposed (accidentally committed to a public git repository, leaked in a log, etc.), an attacker could impersonate the server or decrypt intercepted traffic, requiring the certificate to be immediately revoked and reissued with a new key pair, making private key secrecy the single most critical operational security requirement of the entire TLS system.
Example
# .gitignore should always exclude private key material
*.pfx
*.key
*.pem
appsettings.Production.json # if it contains cert passwords
# Store private keys in a secret manager instead
# e.g., Azure Key Vault, AWS Secrets Manager, HashiCorp Vault
Real-world example
A security incident occurs after a developer accidentally commits a .pfx certificate file (including its private key) to a public GitHub repository, requiring the organization to immediately revoke that certificate, obtain a newly issued one with a fresh key pair, and treat the exposure window as a potential compromise.
Likely follow-ups
What immediate steps should be taken if a private key is discovered to have been exposed?
How do secret managers like Azure Key Vault reduce the risk of private key exposure compared to file-based storage?
By default, UseHttpsRedirection() attempts to infer the HTTPS port from Kestrel's own configuration or the ASPNETCORE_HTTPS_PORT environment variable, but in scenarios where the app runs behind a reverse proxy or in a non-standard port setup, this inference can fail or be wrong, in which case explicitly configuring HttpsRedirectionOptions.HttpsPort ensures the redirect always points to the correct externally-accessible HTTPS port rather than an internal-only port the client can't actually reach.
builder.Services.AddHttpsRedirection(options => {
options.RedirectStatusCode = StatusCodes.Status308PermanentRedirect;
options.HttpsPort = 443; // explicit external port, even if Kestrel listens internally on a different port
});
Real-world example
An app running behind a reverse proxy that exposes HTTPS externally on the standard 443 while Kestrel itself listens internally on 5001 explicitly configures HttpsPort to 443, ensuring redirected clients are sent to the correct externally-reachable address rather than the internal-only port.
Likely follow-ups
What redirect status code should be used, and why does 308 differ meaningfully from 301 for this purpose?
When is HTTPS redirection better handled at the reverse proxy layer instead of within the application?
A robust rotation strategy monitors certificate expiration well in advance (alerting at 30/14/7 days remaining via automated monitoring, not manual calendar reminders), automates renewal and deployment (via a tool like LettuceEncrypt, cert-manager in Kubernetes, or a cloud provider's managed certificate service) rather than relying on manual processes prone to human error or forgotten renewals, and validates the new certificate is actually being served correctly (via an automated post-deployment check) before considering the rotation complete -- treating certificate expiration as a preventable, fully automatable operational failure mode rather than an occasional fire drill.
# Kubernetes cert-manager example -- fully automated certificate lifecycle
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: api-tls
spec:
secretName: api-tls-secret
duration: 2160h # 90 days
renewBefore: 360h # renew 15 days before expiry
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
Real-world example
A postmortem after a production outage caused by an expired certificate (missed due to a manual renewal process depending on one engineer's calendar reminder) leads the team to adopt cert-manager in their Kubernetes cluster, fully automating certificate issuance, renewal, and rotation, eliminating that entire class of human-error-driven outage going forward.
Likely follow-ups
What automated monitoring/alerting should exist as a safety net even with automated rotation in place?
How do you test a certificate rotation process safely before relying on it in production?