Google is committed to advancing racial equity for Black communities. See how.

414 Request-URI Too Long - TooBigLine

You're viewing Apigee Edge documentation.
View Apigee X documentation.

Symptom

The client application gets an HTTP status code of 414 Request-URI Too Long with error code protocol.http.TooBigLine as a response for API calls.

Error message

Client application gets the following response code:

HTTP/1.1 414 Request-URI Too Long

In addition, you may observe the following error message:

{
   "fault":{
      "faultstring":"request line size exceeding 7,168",
      "detail":{
         "errorcode":"protocol.http.TooBigLine"
      }
   }
}

Note that the faultstring in the above error message contains the limit allowed for the request line in Apigee Edge, which is 7168 bytes (7 KB).

Possible causes

This error occurs if the size of the request line sent by the client application to Apigee Edge as part of HTTP request is greater than the allowed limit in Apigee Edge.

Before we look at the possible causes for this error, let’s understand what the request line means and how to check its size.

Understanding Request-Line

A typical HTTP request consists of three parts:

  1. Request-Line
  2. ( Set of HTTP headers )
  3. [ Body ]

The request line consists of three parts as shown below.

Request-Line = <Method> <Request-URI> <HTTP-Version>

When an HTTP request is made by the client application to a server, the first line that goes to the server contains the Request-Line described above. This is followed by the headers and request body/payload.

The following sample screenshot shows a typical curl request, the Request part (along with Request-Line) and the Response part.

Understanding Request-Line size

  1. In the sample discussed above, the start line (first line) in the request, also referred as Request-Line, is as follows:
    GET /test/ HTTP/1.1
    

    The size of the Request-Line is ~19 bytes since it contains 19 ASCII characters. Since this is within the allowed limit in Apigee Edge, the request is processed without any errors and you get a successful response.

  2. Similarly if you look at the faultstring in the Error message shown above, it contains "request line size exceeding 7,168". This indicates that the Request-Line in the HTTP request made by the client exceeded 7,168 bytes.

Here are the possible causes for this error:

Cause Description Troubleshooting instructions applicable for
Request payload size is greater than allowed limit The size of the Request-URI sent by the client application as part of the HTTP request to Apigee Edge is greater than the allowed limit in Apigee Edge. Edge Public and Private Cloud users

Common diagnosis steps

Use one of the following tools/techniques to diagnose this error:

API Monitoring

To diagnose the error using API Monitoring:

  1. Sign in to Apigee Edge UI as a user with an appropriate role.
  2. Switch to the organization in which you want to investigate the issue.

  3. Navigate to the Analyze > API Monitoring > Investigate page.
  4. Select the specific timeframe in which you observed the errors.
  5. Plot Fault Code against Time.
  6. Select a cell which has the fault code protocol.http.TooBigLine and status code 414 as shown below:

    ( view larger image)

  7. You will see the information about the fault code protocol.http.TooBigline as shown below:

    ( view larger image)

  8. Click View logs and expand the row for the failed request:

    ( view larger image)

  9. From the Logs window, note the following details:

    • Status Code: 414
    • Fault Source: apigee
    • Fault Code: protocol.http.TooBigLine.
    • Request Length(bytes): 7244 (> 7KB)
  10. If the Fault Source has the value apigee or MP, the Fault Code has the value protocol.http.TooBigLine and Request-Length is more than 7 KB then that indicates that the HTTP request from the client has a request URI greater than the allowed limit in Apigee.

Trace tool

Nginx

To diagnose the error using Nginx access logs:

  1. If you are a Private Cloud user, then you can use Nginx access logs to determine the key information about HTTP 414 errors.
  2. Check the Nginx access logs:

    /opt/apigee/var/log/edge-router/nginx/ORG~ENV.PORT#_access_log

    Where: ORG, ENV, and PORT# are replaced with actual values.

  3. Search to see if there are any 414 errors during a specific duration (if the problem happened in the past) or if there are any requests still failing with 414.
  4. If you do find any 414 errors with the X-Apigee-fault-code matching the value of protocol.http.TooBigLine, then determine the value of the X-Apigee-fault-source.

    The above sample entry from the Nginx acess log has the following values for X-Apigee-fault-code and X-Apigee-fault-source:

    Response Headers Value
    X-Apigee-fault-code protocol.http.TooBigLine
    X-Apigee-fault-source policy

    Note the Request Length: 7244 (7.244KB > allowed limit)

Cause: Request payload size is greater than allowed limit

Diagnosis

  1. Determine the Fault Code, Fault Source and Request-Length size for the error observed using API Monitoring, Trace Tool or Nginx Access logs as explained in Common diagnosis steps.
  2. If the Fault Source has the value apigee or MP, then this indicates that the request size sent by the client application to Apigee is greater than the allowed limit in Apigee Edge.
  3. You can validate that the request line size has exceeded the 7 KB allowed limit using one of the following methods:

    Error message

    To validate using the error message:

    If you have access to the complete error message received from Apigee Edge, then refer to the faultstring. The faultstring indicates that the Request-Line size exceeded the allowed limit of 7 KB.

    Sample error message:

    "faultstring":"request line size exceeding 7,168"
    

    Actual request

    To validate using the actual request:

    If you have access to the actual request made by the client application, then perform the following steps:

    1. Verify the size of the URI passed in the request.
    2. If you find that the size of the URI is more than the allowed limit in Apigee Edge, then that is the cause of the issue.

      Sample request:

      curl http://<hostalias>/testtoobigline?_qparam=000000000000000000……..000000<trimmed> -k -X POST
      

      In the above case, the value of the query parameter qparam is larger than 7 KB, that is, it contains more than 7 K ASCII characters.

      If you are using some other client, you can review the client logs and try to find out the size of the request line being sent to Apigee Edge.

    Message Processor logs

    To validate using Message Processor logs:

    If you are a Private Cloud user, then you can use Message Processor logs to validate if the Request-Line size has exceeded the allowed limit in Apigee Edge.

    1. Check the Message Processor logs:

      /opt/apigee/var/log/edge-message-processor/logs/system.log

    2. Search to see if there are any 414 Errors during a specific duration (if the problem happened in the past) or if there are any requests still failing with 414. You may use the following search strings.
      grep -ri "exceeding"
      
      grep -ri "RequestURITooLong"
      
    3. You will find lines from system.log similar to the following:
      2021-07-12 08:53:31,461  NIOThread@0 ERROR ADAPTORS.HTTP.FLOW -
      AbstractRequestListener.onException() : Request:null, uri:null,
      message Id:null, exception:com.apigee.errors.http.user.RequestURITooLong{
      code = protocol.http.TooBigLine, message = request line size exceeding 7,168,
      associated contexts = []}, context:Context@366f4217
      input=ClientInputChannel(SSLClientChannel[Accepted: Remote:192.168.195.90:8443
      Local:192.168.67.23:34256]@301912 useCount=1 bytesRead=0 bytesWritten=45849
      age=2254670ms lastIO=0ms isOpen=true)
      

      The text message = request line size exceeding 7,168 in the above error message indicates that the Request URI size is more than 7 KB. Therefore, Apigee Edge throws the exception com.apigee.errors.http.user.RequestURITooLong and returns 414 status code with fault code protocol.http.TooBigline to client applications.

Resolution

Fix size

Option #1 [Recommended]: Fix the client application not to send request URI size greater than the allowed limit

  1. Analyze the reason for the specific client to send request URI size more than allowed limit as defined in Limits.
  2. If it is not desirable, modify your client application so that it sends request URI size less than the allowed limit.

    In the example discussed above, you can fix the issue by passing the long query parameter as part of the request body/payload instead of passing it as part of the request URL as shown below:

    curl https://<host>/testtoobigline -k -X GET -d '{_qparam=000000000000000000<trimmed>}' -v
    
  3. If it is desirable and you want to send a URI more than the allowed limit, go to the next options.

CwC

Option #2 : Use CwC property to increase the request line limit

Apigee provides a CwC property which allows it to increase the request line size limit. For details see Set the request line limit on the Message Processor

Limits

Apigee expects the client application and backend server do not send Request/Response-Lines whose sizes are greater than the allowed limit as documented for Request/Response Line Limit in Apigee Edge Limits.

  1. If you are a Public Cloud user, then the maximum limit for Request and Response Line size is as documented for Request/Response-Line size in Apigee Edge Limits.
  2. If you are a Private Cloud user, then you may have modified the default maximum limit for Request and Response-Line size (even though it is not a recommended practice). You can determine the maximum Request-Line size limit by following instructions in How to check the current limit.

How to check the current limit?

This section explains how to verify that the property HTTPRequest.line.limit has been updated with a new value on the Message Processors.

  1. On the Message Processor machine, search for the property HTTPRequest.line.limit in the /opt/apigee/edge-message-processor/conf directory and check to see what value has been set as shown below:
    grep -ri "HTTPRequest.line.limit" /opt/apigee/edge-message-processor/conf
    
  2. The sample result from the above command is as follows:
    /opt/apigee/edge-message-processor/conf/http.properties:HTTPRequest.line.limit=7k
    
  3. In the example output above, note that the property HTTPRequest.line.limit has been set with the value 7k in http.properties.

    This indicates that the limit for the Request-Line size configured in Apigee for Private Cloud is 7 KB.

If you still need any assistance from Apigee Support, go to Must gather diagnostic information.

Must gather diagnostic information

Gather the following diagnostic information, and then contact Apigee Support:

If you are a Public Cloud user, provide the following information:

  • Organization name
  • Environment name
  • API Proxy name
  • Complete curl command used to reproduce the 414 error
  • Trace file for the API requests

If you are a Private Cloud user, provide the following information:

  • Complete error message observed for the failing requests
  • Organization name
  • Environment name
  • API Proxy bundle
  • Trace file for the failing API requests
  • Complete curl command used to reproduce the 414 error
  • Nginx access logs /opt/apigee/var/log/edge-router/nginx/ORG~ENV.PORT#_access_log

    Where: ORG, ENV and PORT# are replaced with actual values.

  • Message Processor system logs /opt/apigee/var/log/edge-message-processor/logs/system.log