Search code examples
jsonajaxhttpgetserver-side

Sending payload in GET request's body instead of POST to resolve HTTP 414 URI Too Long


A 414 error is caused by a long URI parameters on a GET request. It has been suggested here and here to use a POST request in that case, however, wouldn't it be more realistic to send the data in the GET request's body, even though it is not recommended to do so?


Solution

  • It's not a good practice to send data in the GET request's body. According to RFC7231:

    A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.

    Thus, it's not "more realistic", but actually less realistic, as some browser or server may reject such HTTP request.