gravitational/teleport · error

http.StatusText(code)

Error message

http.StatusText(code)

What it means

The GCP app handler's formatForwardResponseError writes the standard status text for the trace-mapped HTTP code as the response body when forwarding a request to the GCP API fails; the literal is the reason phrase for the mapped code.

Source

Thrown at lib/srv/app/gcp/handler.go:191

	}
	recorder := httplib.NewResponseStatusRecorder(w)
	s.fwd.ServeHTTP(recorder, fwdRequest)
	status := uint32(recorder.Status())

	if err := sessionCtx.Audit.OnRequest(req.Context(), sessionCtx, fwdRequest, status, nil); err != nil {
		// log but don't return the error, because we already handed off request/response handling to the oxy forwarder.
		s.Log.WarnContext(req.Context(), "Failed to emit audit event.", "error", err)
	}
	return nil
}

func (s *handler) formatForwardResponseError(rw http.ResponseWriter, r *http.Request, err error) {
	s.Log.DebugContext(r.Context(), "Failed to process request.", "error", err)
	common.SetTeleportAPIErrorHeader(rw, err)

	// Convert trace error type to HTTP and write response.
	code := trace.ErrorToCode(err)
	http.Error(rw, http.StatusText(code), code)
}

// prepareForwardRequest prepares a request for forwarding, updating headers and target host. Several checks are made along the way.
func (s *handler) prepareForwardRequest(r *http.Request, sessionCtx *common.SessionContext) (*http.Request, error) {
	forwardedHost, err := utils.GetSingleHeader(r.Header, "X-Forwarded-Host")
	if err != nil {
		return nil, trace.AccessDenied("%s", err)
	} else if !gcp.IsGCPEndpoint(forwardedHost) {
		return nil, trace.AccessDenied("%q is not a GCP endpoint", forwardedHost)
	}

	payload, err := utils.GetAndReplaceRequestBody(r)
	if err != nil {
		return nil, trace.Wrap(err)
	}

	reqCopy, err := http.NewRequest(r.Method, r.URL.String(), bytes.NewReader(payload))
	if err != nil {

View on GitHub (pinned to 1283425b60)

Solutions

  1. Check the proxy logs for the underlying forward error
  2. Verify the GCP app integration credentials and project configuration
  3. Address the root cause per the mapped status code and retry
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at lib/srv/app/gcp/handler.go:191 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gravitational/teleport@1283425b60 (2026-09-02). Data as JSON: /api/errors/3967f78494d36d66. Report an issue: GitHub.