nats-io/nats-server · error

non-ok http status on POST request (reqlen=%d): %d

Error message

non-ok http status on POST request (reqlen=%d): %d

What it means

getRemoteStatus's POST helper: the OCSP responder replied with an HTTP status above 299 to the application/ocsp-request POST. Includes body length and status code; the monitor then falls back to GET or the next responder URL.

Source

Thrown at server/ocsp.go:201

	postRequestBytes := func(u string, body []byte, hc *http.Client) ([]byte, error) {
		hreq, err := http.NewRequest("POST", u, bytes.NewReader(body))
		if err != nil {
			return nil, err
		}
		hreq.Header.Add("Content-Type", "application/ocsp-request")
		hreq.Header.Add("Accept", "application/ocsp-response")

		start := time.Now()
		resp, err := hc.Do(hreq)
		if err != nil {
			return nil, err
		}
		defer resp.Body.Close()

		oc.srv.Debugf("Received OCSP response (method=POST, status=%v, url=%s, duration=%.3fs)",
			resp.StatusCode, u, time.Since(start).Seconds())
		if resp.StatusCode > 299 {
			return nil, fmt.Errorf("non-ok http status on POST request (reqlen=%d): %d", len(body), resp.StatusCode)
		}
		return io.ReadAll(resp.Body)
	}

	// Request documentation:
	// https://tools.ietf.org/html/rfc6960#appendix-A.1

	reqDER, err := ocsp.CreateRequest(oc.Leaf, oc.Issuer, nil)
	if err != nil {
		return nil, nil, err
	}

	responders := oc.Leaf.OCSPServer
	if len(overrideURLs) > 0 {
		responders = overrideURLs
	}
	if len(responders) == 0 {
		return nil, nil, fmt.Errorf("no available ocsp servers")

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Verify responder reachability and that it accepts OCSP POST requests
  2. Rely on the built-in GET fallback and remaining responder URLs
  3. Check network egress/firewall rules from the server
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at server/ocsp.go:201 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/a2edc7677a318a3c. Report an issue: GitHub.