OCSP Stapling in NGINX: How It Works and Whether You Still Need It
OCSP stapling lets a web server fetch a signed, time-limited "this certificate is still valid" response from its certificate authority (CA) and send it to browsers during the TLS handshake. That saves each browser from contacting the CA itself, improving privacy and speed. In NGINX you enable it with ssl_stapling on; and ssl_stapling_verify on; plus the CA chain.
Topic: Cybersecurity Foundations in Cybersecurity & Ethical Hacking · Troubleshooting
Quick answer: OCSP stapling lets a web server fetch a signed, time-limited "this certificate is still valid" response from its certificate authority (CA) and send it to browsers during the TLS handshake. That saves each browser from contacting the CA itself, improving privacy and speed. In NGINX you enable it with ssl_stapling on; and ssl_stapling_verify on; plus the CA chain. However, the ecosystem has changed: Let's Encrypt ended OCSP support in favour of certificate revocation lists (CRLs), and the CA/Browser Forum made OCSP optional. Stapling now only matters if your certificate still includes an OCSP URL.
Key takeaways
- OCSP answers "has this certificate been revoked?"
- Stapling moves the OCSP query from the browser to the server.
- Let's Encrypt certificates no longer carry OCSP URLs, so stapling does nothing for them.
- Commercial CAs that still provide OCSP can benefit from stapling.
- Test stapling with
openssl s_client -status.
Table of Contents
- How Does Certificate Revocation Work?
- What Problem Does Stapling Solve?
- What Changed in 2024 and 2025?
- How Do You Configure Stapling in NGINX?
- How Do You Test It?
- What Are Common Problems?
- References
How Does Certificate Revocation Work?
If a certificate's private key is compromised, the CA revokes it. Clients learn about revocation through certificate revocation lists (CRLs), downloadable lists of revoked serial numbers, or the Online Certificate Status Protocol (OCSP, RFC 6960), which answers for a single certificate. Browsers also use their own revocation data feeds.
What Problem Does Stapling Solve?
| Client-side OCSP | OCSP stapling | |
|---|---|---|
| Who queries the CA | Every browser | The server, periodically |
| Privacy | CA learns which sites users visit | CA sees only the server |
| Speed | Extra lookup during connection | Response included in handshake |
| Standard | RFC 6960 | TLS status_request extension, RFC 6066 |
What Changed in 2024 and 2025?
In July 2024, Let's Encrypt announced it would end OCSP and rely on CRLs, citing privacy and operating costs; it then removed OCSP URLs from its certificates and later shut its OCSP service down. The CA/Browser Forum Baseline Requirements made OCSP optional for publicly trusted CAs. Check your certificate for an OCSP URL:
openssl x509 -in /etc/ssl/certs/example.crt -noout -ocsp_uri
# no output means the certificate has no OCSP responder, so stapling is unnecessary
How Do You Configure Stapling in NGINX?
If your certificate still has an OCSP URL, use the NGINX ssl_stapling directives:
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/ssl/example/fullchain.pem;
ssl_certificate_key /etc/ssl/example/privkey.pem;
ssl_trusted_certificate /etc/ssl/example/chain.pem; # CA chain for verification
ssl_stapling on;
ssl_stapling_verify on;
resolver 1.1.1.1 9.9.9.9 valid=300s;
resolver_timeout 5s;
}
Reload with sudo nginx -t && sudo systemctl reload nginx. NGINX fetches the response on demand, so the first connection after a reload may not include a staple.
How Do You Test It?
openssl s_client -connect example.com:443 -servername example.com -status < /dev/null 2>/dev/null | grep -A 3 "OCSP response"
# "OCSP Response Status: successful" means stapling works
# "OCSP response: no response sent" means no staple (normal for certificates without OCSP)
Use the Mozilla SSL Configuration Generator for current TLS settings.
What Are Common Problems?
- No resolver set: NGINX cannot reach the OCSP responder.
- Missing chain: verification fails without
ssl_trusted_certificate. - Outbound firewall: the server cannot reach the CA's OCSP URL over HTTP.
- Certificate has no OCSP URL: expected for Let's Encrypt today; nothing to fix.
Related: how TLS works and Linux server hardening. WebAsha offers Linux and web server security training.
References
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0