Getting error "HTTP/1.1 431 Request Header Fields Too Large" in Apache Jmeter

Skip to first unread message

AP Singh

May 8, 2024, 3:25:55 PMMay 8
to JMeter Forum

I have an API in Jmeter in which I am passing a token(extracted from previous API) and I am getting an error: HTTP/1.1 431 Request Header Fields Too Large.

To pass headers I am using HHTP Header Manger 

This API however works fine from Postman on same machine.


May 9, 2024, 3:46:40 AMMay 9
to JMeter Forum

The error is self-explanatory, as per Request Header Fields Too Large article:

The HTTP 431 Request Header Fields Too Large response status code indicates that the server refuses to process the request because the request's HTTP headers are too long. The request may be resubmitted after reducing the size of the request headers.

431 can be used when the total size of request headers is too large, or when a single header field is too large. To help those running into this error, indicate which of the two is the problem in the response body — ideally, also include which headers are too large. This lets users attempt to fix the problem, such as by clearing their cookies.

Try use Debug Sampler to see your access_token_metadata header value, it might be the case your correlation fails somehow and pulls some extra data

In general if you can successfully execute your request with Postman you should be able to record it using JMeter's HTTP(S) Test Script Recorder, you will need to:

  1. Configure Postman to use JMeter as the proxy

    enter image description here

  2. Import JMeter's certificate into Postman

    enter image description here

More information: How to Convert Your Postman API Tests to JMeter for Scaling

Reply all
Reply to author
0 new messages