What is the HTTP TRACE Method?

Learn what the HTTP TRACE method is, how it works, and what benefits it offers for API debugging. Also, learn how to use Apidog, Postman, Swagger, and JMeter to send and analyze HTTP TRACE requests, and how to secure your APIs against cross-site tracing attacks.

Ashley Innocent

Ashley Innocent

9 May 2025

What is the HTTP TRACE Method?

Have you ever wondered how your APIs are behaving behind the scenes? How do you know if they are sending and receiving the right data, or if they are being modified by intermediaries along the way?  That’s where the HTTP TRACE method comes in handy. The HTTP TRACE method is a special type of HTTP request that performs a message loop-back test along the path to the target resource. It allows you to see the exact message that was received by the final recipient, excluding any sensitive data, such as cookies or credentials.

In this blog post, I will show you how to use the HTTP TRACE method to debug your APIs like a pro. I will explain what the HTTP TRACE method is, how it works, and what benefits it offers. I will also show you how to use Apidog.

💡
Apidog is an integrated platform for API design, debugging, development, mocking, and testing, to send and analyze HTTP TRACE requests for free.
button

What is the HTTP TRACE Method?

The HTTP TRACE method is one of the standard HTTP methods, defined in the RFC 2616 specification. It is used to perform a message loop-back test along the path to the target resource, providing a useful debugging mechanism. The final recipient of the request should reflect the message received, excluding any fields that might include sensitive data, back to the client as the message body of a 200 (OK) response with a Content-Type of message/http. The final recipient is either the origin server or the first server to receive a Max-Forwards value of 0 in the request.

The syntax of the HTTP TRACE method is as follows:

TRACE /path HTTP/1.1
Host: example.com

The request has no body, and the path is the URI of the target resource. The request may include a Max-Forwards header, which indicates the maximum number of intermediaries that can forward the request. If the Max-Forwards value is 0, the request should not be forwarded, and the response should be generated by the first server that receives it. If the Max-Forwards value is not specified, the request can be forwarded indefinitely, until it reaches the origin server or an intermediary that does not support the HTTP TRACE method.

The response to the HTTP TRACE request should have a status code of 200 (OK) and a Content-Type of message/HTTP. The response body should contain the exact message that was received by the final recipient, excluding any sensitive data. The response may also include a Via header, which indicates the intermediaries that processed the request. The Via header should have one or more entries, each consisting of the protocol name, protocol version, and the intermediary’s identifier. For example:

HTTP/1.1 200 OK
Content-Type: message/http
Via: 1.1 proxy1.example.com, 1.1 proxy2.example.com

TRACE /path HTTP/1.1
Host: example.com

The response shows that the request was forwarded by two proxies, proxy1.example.com and proxy2.example.com, before reaching the final recipient. The response body reflects the original request, including the path and the host header.

How Does the HTTP TRACE Method Work?

The HTTP TRACE method works by sending a request to the target resource and expecting a response that contains the same request message. This allows the client to see the exact message that was received by the server, and to check if there were any modifications or errors along the way.

The HTTP TRACE method can be used to debug various aspects of the API behavior, such as:

The HTTP TRACE method can also be used to test the security and compliance of the API, such as:

How to Test API Endpoint (Complete Guide)
In this article, we’ll explore how to test an API endpoint. Let’s dive into the key steps to maintain the quality of your API endpoint.

What are the Benefits of the HTTP TRACE Method?

The HTTP TRACE method offers several benefits for API developers, testers, and consumers, such as:

How to Use Apidog to Send and Analyze HTTP TRACE Requests?

Apidog is an integrated platform for API design, debugging, development, mock, and testing, that combines Postman + Swagger + Mock + JMeter to tackle the data synchronization problem among different systems using a set of systems and a set of data. Apidog is a complete set of tools that connects the entire API lifecycle, helping R&D teams implement best practices for API Design-first development.

button

Apidog offers a convenient and easy way to send and analyze HTTP TRACE requests, as well as other HTTP methods. To use Apidog to send and analyze HTTP TRACE requests, you need to follow these steps:

apidog interface
apidog interface
apidog interface

In the response panel, you can see the status

How to Enable or Disable the HTTP TRACE Method on the Server?

Depending on your server configuration and security policy, you may want to enable or disable the HTTP TRACE method on your server. Enabling the HTTP TRACE method allows you to debug your APIs more easily, but it may also expose some information that could be exploited by malicious actors. Disabling the HTTP TRACE method prevents such attacks, but it also limits your debugging capabilities.

The process of enabling or disabling the HTTP TRACE method varies depending on the type and version of your server. Here are some examples of how to do it for some common servers:

TraceEnable off

To limit the TRACE method to the local server only, you can add the following line:

TraceEnable extended
location / {
  limit_except GET POST HEAD {
    deny all;
  }
}

To limit the TRACE method to the local server only, you can add the following block:

location / {
  limit_except GET POST HEAD TRACE {
    deny all;
  }
  if ($request_method = TRACE) {
    return 200;
  }
}

Conclusion

The HTTP TRACE method is a useful debugging tool for APIs, that allows you to perform a message loop-back test along the path to the target resource. It can help you verify the presence and identity of intermediaries, the integrity and validity of headers and bodies, the performance and latency of requests and responses, and the security and compliance of your APIs.

To use the HTTP TRACE method, you need to send a request to the target resource and expect a response that reflects the same request message, excluding any sensitive data. You can use various tools and frameworks to send and analyze HTTP TRACE requests, such as Apidog. Apidog offers a convenient and easy way to send and analyze HTTP TRACE requests.

button

Explore more

SuperClaude: Power Up Your Claude Code Instantly

SuperClaude: Power Up Your Claude Code Instantly

The arrival of large language models in the software development world has been nothing short of a revolution. AI assistants like Anthropic's Claude can draft code, explain complex algorithms, and debug tricky functions in seconds. They are a phenomenal force multiplier. Yet, for all their power, a lingering sense of genericness remains. Professional developers often find themselves grappling with the same frustrations: the AI's short memory, its lack of context about their specific project, the

25 June 2025

What's a Claude.md File? 5 Best Practices to Use Claude.md for Claude Code

What's a Claude.md File? 5 Best Practices to Use Claude.md for Claude Code

Here's a true story from a Reddit user, a C++ dev and ex-FAANG staff engineer: For four years, a "white whale" bug lurked in the codebase of a C++ developer with over 30 years of experience. A former FAANG Staff Engineer, this was the kind of programmer other developers sought out when all hope was lost. Yet, this particular bug, introduced during a massive 60,000-line refactor, remained elusive. It was an annoying edge case, a ghost in the machine that defied discovery despite an estimated 200

25 June 2025

How to Run Qwen3 Embedding and Reranker Models Locally with Ollama

How to Run Qwen3 Embedding and Reranker Models Locally with Ollama

The world of large language models (LLMs) is expanding at an explosive pace, but for a long time, accessing state-of-the-art capabilities meant relying on cloud-based APIs. This dependency often comes with concerns about privacy, cost, and customization. The tide is turning, however, thanks to powerful open-source models and tools like Ollama that make running them on your local machine easier than ever. Among the most exciting recent developments is the release of the Qwen3 model family by Ali

25 June 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs