What Is OCSP Stapling and How to Enable It

OCSP Stapling improves both performance and privacy for SSL certificate validation — letting your server proactively provide certificate revocation status rather than requiring each visitor's browser to check separately.

What OCSP Does

Online Certificate Status Protocol lets a browser verify a certificate hasn't been revoked since issuance — without stapling, this means every visitor's browser makes a separate request to the Certificate Authority's OCSP server on every visit.

The Problem OCSP Stapling Solves

  • Performance — each visitor's browser making a separate OCSP request adds latency to page load
  • Privacy — without stapling, the CA's OCSP server can see which sites individual visitors are checking certificates for
  • Reliability — if the CA's OCSP server is slow or unreachable, browsers may hang or behave inconsistently

How Stapling Fixes This

With OCSP stapling enabled, your server periodically fetches the OCSP response itself and includes ("staples") it directly in the TLS handshake with visitors — eliminating the need for each individual browser to make a separate request.

Enabling OCSP Stapling in Nginx

server {
    listen 443 ssl;
    server_name yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_trusted_certificate /etc/letsencrypt/live/yourdomain.com/chain.pem;
    resolver 8.8.8.8 8.8.4.4 valid=300s;
}

ssl_trusted_certificate should point to the CA's chain certificate (not your own certificate), and resolver specifies DNS servers Nginx uses to reach the OCSP responder.

Enabling OCSP Stapling in Apache

<VirtualHost *:443>
    SSLUseStapling on
    SSLStaplingCache "shmcb:/var/run/ocsp(128000)"
</VirtualHost>
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off

Testing Whether Stapling Is Working

echo | openssl s_client -connect yourdomain.com:443 -status 2>/dev/null | grep -A 5 "OCSP Response"

A successful response shows "OCSP Response Status: successful" — if stapling isn't working, this section will be absent or show an error.

Reloading After Configuration

sudo nginx -t && sudo systemctl reload nginx

Does Every Certificate Support Stapling?

Most modern certificates from established CAs support OCSP, making stapling available — verify your specific certificate's issuing CA provides OCSP responses if stapling doesn't appear to work despite correct configuration.

Common Errors

Stapling configured but no response returned — verify the resolver directive is correctly set (Nginx needs to resolve the OCSP responder's hostname), and that outbound connectivity to the CA's OCSP server isn't blocked by a firewall.

"ssl_trusted_certificate" pointing to the wrong file — this should be the CA's intermediate/chain certificate, not your site's own leaf certificate; a common configuration mix-up.

Continue Reading

Browse more articles in SSL/TLS & Certificates.

  • ocsp stapling, ssl certificate validation, nginx ocsp, certificate revocation
  • 0 Usuários acharam útil
Esta resposta lhe foi útil?

Artigos Relacionados

How to Install Let's Encrypt SSL with Certbot (Nginx & Apache)

Let's Encrypt provides free, automated SSL/TLS certificates trusted by all major browsers....

HTTP to HTTPS Redirect: Forcing SSL on Nginx & Apache

Once SSL is installed, visitors reaching your site over plain HTTP should be automatically...

How to Renew and Auto-Renew Let's Encrypt Certificates

Let's Encrypt certificates are valid for only 90 days by design, to limit the impact of a...

How to Install a Wildcard SSL Certificate with Certbot DNS Challenge

A wildcard certificate secures a domain and all of its subdomains (*.example.com) with a single...

Common SSL Certificate Errors and How to Fix Them

SSL/TLS errors block visitors from accessing your site securely and can be caused by several...