meta

HTTP TRACE

Performs a message loop-back test along the path to the target resource, so the client can see exactly what proxies received. The final recipient echoes the request back as the message body of a 200 response.

TRACE /path HTTP/1.1

Properties

Property Value / Meaning
Safe Yes - TRACE is diagnostic and has no side effects on resources.
Idempotent Yes - repeating TRACE returns an equivalent echo each time.
Cacheable No - responses are per-request diagnostic echoes.
Has body No - a body must not be sent; servers ignore it.
Body in response Yes - the response body is the exact received request with Content-Type: message/http.

Examples

curl -X TRACE -i https://example.com/

Ask the server to echo the received request for debugging.

TRACE /debug HTTP/1.1\nHost: example.com\nMax-Forwards: 0

Max-Forwards: 0 stops at the first proxy, useful for hop-by-hop inspection.

curl -X TRACE -H 'X-Debug: 1' https://example.com/

Verify how intermediaries mutate your custom headers.

curl -X TRACE -H 'Max-Forwards: 3' https://example.com/

Trace up to 3 proxy hops before echoing back.

Gotcha

TRACE is disabled on most production servers because of the historical Cross-Site Tracing (XST) attack. Cookies and Authorization headers get echoed back verbatim, so never enable TRACE on user-facing hosts.

Related methods

← All HTTP methods · HTTP status codes · HTTP headers