Getting error protocol.http.TooBigLine, "response line size exceeding 2,048"

We're observing below exception consistently and not much detail has been provided in the documentation. If someone can help in this regard with the root cause of such issues.

{
  "fault": {
    "faultstring": "response line size exceeding 2,048",
    "detail": {
      "errorcode": "protocol.http.TooBigLine"
    }
  }
}

The response is: 502 Bad Gateway

Solved Solved
0 5 2,695
1 ACCEPTED SOLUTION

Apigee is telling you that It has received an invalid response from some remote system. Usually the target (TargetEndpoint). It could alternatively be the remote system you connect to via ServiceCallout.

In any case "response line size exceeding 2048" indicates that the initial response line from an HTTP request exceeded 2048 bytes (which would equate to characters, since the response line is expected to be ASCII).

The HTTP Response line for a successful request is usually something like this:

HTTP/1.1 200 OK

That's 15 bytes, 15 ASCII characters. I believe the error message is telling you: the remote system sent a text line in response that exceeds 2048 bytes.

Why would this happen?

This is not a problem in Apigee. It's a problem with the remote system.

One reason it might happen is if the target of your remote call is not an HTTP system. It could be responding with something that is not a valid HTTP response. Apigee speaks HTTP; the design of the proxy assumes every target is an HTTP system. If Apigee receives "non HTTP" response that happens to exceed 2048 characters, it will not give you an error saying "hey, that does not look like HTTP". Instead it will say "That line exceeded 2048 characters."

Another reason the error might happen is if Apigee is communicating with an HTTP system which itself is broken or buggy. The effect is the same.

Apigee will not return the error message you are reporting in other situations. For example, if the remove HTTP system returns a response with a header parameter that exceeds 2048 bytes, that would NOT cause a "TooBigLine" error. (Actually I believe that the limit Apigee enforces on the size of a response header is 25k. For the purposes of this discussion, it does not matter.).

The error you would see if the HTTP Response line was valid, something like "HTTP/1.1 200 OK" ,, but a header was too long, would be something like this:

{
  "fault": {
    "faultstring": "response headers size exceeding 25,600",
    "detail": {
      "errorcode": "protocol.http.TooBigHeaders"
    }
  }
}

How can you diagnose the error you're seeing? First, verify to the extent that you can, that the target system to which Apigee is connecting is the intended target system. It's a real HTTP endpoint and gives valid responses.

Once you confirm that, I suggest turning on Trace in Apigee, to see the actual response. It may be shown in the Trace UI. If not (because of the error condition), then you have some other options.

  1. use Apigee Trace to view the actual request being sent to the target. Using curl or another client side tool, send that same request to the target, and view the actual response.
  2. View the actual response by turning on some logging or tracing on the target system, if you control it.

With the actual response, you will probably very quickly see the response line that exceeds 2048 characters, and you should be able to deduce what is going wrong.

In short, Apigee is connecting with a remote system that is not sending a valid HTTP response. You need to examine that response in order to deduce the reason why.

View solution in original post

5 REPLIES 5

Apigee is telling you that It has received an invalid response from some remote system. Usually the target (TargetEndpoint). It could alternatively be the remote system you connect to via ServiceCallout.

In any case "response line size exceeding 2048" indicates that the initial response line from an HTTP request exceeded 2048 bytes (which would equate to characters, since the response line is expected to be ASCII).

The HTTP Response line for a successful request is usually something like this:

HTTP/1.1 200 OK

That's 15 bytes, 15 ASCII characters. I believe the error message is telling you: the remote system sent a text line in response that exceeds 2048 bytes.

Why would this happen?

This is not a problem in Apigee. It's a problem with the remote system.

One reason it might happen is if the target of your remote call is not an HTTP system. It could be responding with something that is not a valid HTTP response. Apigee speaks HTTP; the design of the proxy assumes every target is an HTTP system. If Apigee receives "non HTTP" response that happens to exceed 2048 characters, it will not give you an error saying "hey, that does not look like HTTP". Instead it will say "That line exceeded 2048 characters."

Another reason the error might happen is if Apigee is communicating with an HTTP system which itself is broken or buggy. The effect is the same.

Apigee will not return the error message you are reporting in other situations. For example, if the remove HTTP system returns a response with a header parameter that exceeds 2048 bytes, that would NOT cause a "TooBigLine" error. (Actually I believe that the limit Apigee enforces on the size of a response header is 25k. For the purposes of this discussion, it does not matter.).

The error you would see if the HTTP Response line was valid, something like "HTTP/1.1 200 OK" ,, but a header was too long, would be something like this:

{
  "fault": {
    "faultstring": "response headers size exceeding 25,600",
    "detail": {
      "errorcode": "protocol.http.TooBigHeaders"
    }
  }
}

How can you diagnose the error you're seeing? First, verify to the extent that you can, that the target system to which Apigee is connecting is the intended target system. It's a real HTTP endpoint and gives valid responses.

Once you confirm that, I suggest turning on Trace in Apigee, to see the actual response. It may be shown in the Trace UI. If not (because of the error condition), then you have some other options.

  1. use Apigee Trace to view the actual request being sent to the target. Using curl or another client side tool, send that same request to the target, and view the actual response.
  2. View the actual response by turning on some logging or tracing on the target system, if you control it.

With the actual response, you will probably very quickly see the response line that exceeds 2048 characters, and you should be able to deduce what is going wrong.

In short, Apigee is connecting with a remote system that is not sending a valid HTTP response. You need to examine that response in order to deduce the reason why.

Thanks @dino-at-Google for detailed explaination. It helps.

I'm seeing a similar issue and doing a debug session in Apigee is not showing the request. So it seems like it's coming from the Google Cloud load balancer (or something before Apigee):

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

Please note the request/response size limits on the product limits page (10 MB)

https://cloud.google.com/apigee/docs/api-platform/reference/limits#system

Thanks for the reference! Is there any reason why these requests aren't showing in the Apigee debug console? I'd like to create a custom FaultRule for this, but the request doesn't seem to be making it to the flow.