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

21 July 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

Qwen3-Coder is Finally Here and It's Breaking All the Coding Benchmarks

Qwen3-Coder is Finally Here and It's Breaking All the Coding Benchmarks

Discover how Qwen3-Coder revolutionizes software development with its 480B-parameter architecture, state-of-the-art coding capabilities, and seamless integration.

23 July 2025

How to Download the Kiro AI IDE without Waitlist

How to Download the Kiro AI IDE without Waitlist

Skip the Kiro AI IDE waitlist and get started right away! This guide shows you how to download Kiro for Windows or Mac, explains its features, and reveals why Apidog is the essential API platform for AI-powered development.

22 July 2025

The Ultimate Guide to API Mocking: Build APIs Faster

The Ultimate Guide to API Mocking: Build APIs Faster

In the rapidly evolving landscape of software development, waiting for backend APIs is a major bottleneck. This guide explores how modern API mocking tools solve this problem, moving beyond simple stubs to advanced simulations.

21 July 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs