How to Fix MongoDB Error 302 (OCSPCertificateStatusUnknown)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get mongodb error 302 when the database cannot check a TLS certificate status. You fix it by restoring network traffic to the responder or fixing your certificates. The official error name for this issue is OCSPCertificateStatusUnknown. It stops secure handshakes before any user can log in or run a query. Teams see this failure when strict TLS rules block unknown certificate states. What causes mongodb error 302 in your cluster MongoDB uses the Online Certificate Status Protocol to check

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You get mongodb error 302 when the database cannot check a TLS certificate status. You fix it by restoring network traffic to the responder or fixing your certificates.

The official error name for this issue is OCSPCertificateStatusUnknown. It stops secure handshakes before any user can log in or run a query. Teams see this failure when strict TLS rules block unknown certificate states.

What causes mongodb error 302 in your cluster

MongoDB uses the Online Certificate Status Protocol to check if a certificate is valid. During a TLS handshake, the server or client asks an authority for a status. If the responder returns an unknown state, the database throws code 302.

This failure often starts in your network path. Strict outbound firewall rules can block the database from reaching the status responder. DNS failures or proxy drops also stop the status check from finishing on time.

Certificate authority issues also trigger OCSPCertificateStatusUnknown. A private authority might not sync its status database with new certificates right away. Clock skew between your database nodes and the responder will also break status checks.

Finally, expired intermediate certificates cause the responder to reject the lookup. The responder does not know the issuer, so it reports an unknown status.

How to diagnose and fix the failure in production

Start by checking the network path from your database nodes and client apps. Make sure outbound rules allow traffic to your certificate authority responder URL. Fix any DNS rules that block external host lookups on your database subnet.

Next, inspect the full certificate chain on both the server and the client. Check that the root and intermediate certificates match your authority records. Replace any certificate that lacks a valid responder URL or uses an old issuer.

MongoDB Authentication & Authorization + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Check the system clock on every cluster node and app server. Use a time sync service so all machines share the exact same time. Even a small time gap can make a fresh status response look invalid.

If you use OCSP stapling, check that your load balancer refreshes the staple often. A stale staple with an unknown state will cause clients to drop the link. Renewing the cert and restarting the TLS listener clears out bad cached responses.

Keep database security strong during repairs

Never turn off TLS checks in production just to bypass code 302. Skipping certificate checks opens your network to man in the middle attacks. Fix the responder link instead of lowering your security posture.

Keep database privileges tight while your team tests the fix. MongoDB grants access through role-based rules that apply to a single database. These roles can control actions down to a collection level.

Give engineers the built-in read role when they test connectivity after a certificate fix. The read role lets them run find, listCollections, listIndexes, dbStats, and collStats safely. It blocks insert, update, remove, and dropCollection actions so tests cannot change live data.

Reserve the readWrite role for apps that must modify records after the TLS fix. Also make sure your query tools mask sensitive fields like emails and phone numbers. Masking rewrites matched fields in results so debugging stays safe.

Add command guardrails and field masking beside MongoDB

Collection roles and IP rules control who connects to MongoDB. Yet an active client or agent session can still run a pipeline that writes data or reads raw personal fields. In practice, hoop.dev sits inline in the wire protocol beside your database as a sidecar for your MongoDB. For every command an agent or human sends in production, hoop.dev decides to pass, mask, block, or escalate it for review.

Using hoop.dev MongoDB controls, guardrails refuse banned commands before they run or hold risky calls for approval, and data masking rewrites matched fields in returned documents in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for GDPR, HIPAA, and PCI DSS programs. View the project on GitHub.

Frequently asked questions

What does OCSPCertificateStatusUnknown mean in MongoDB?

It means the OCSP responder could not confirm if a TLS certificate is valid. The database blocks the handshake because the certificate status is unknown.

Can a firewall rule cause mongodb error 302?

Yes, outbound firewall blocks are a top cause for this error code. If the server or client cannot reach the OCSP responder, the check fails.

Should I disable OCSP checks to fix code 302 fast?

No, turning off status checks lets revoked certificates log in to your cluster. Always fix the network path or renew the bad certificate chain instead.

The query runs. The emails stay hidden.