HTTP statuses from the standalone dispatcher

The standalone dispatcher, httpdispatch, refuses some requests itself, before they reach the GAS. This topic lists the HTTP statuses it returns and how you can resolve them.

httpdispatch records these refusals in httpdispatch.log, so open that file and match the message you are seeing against the statuses in Table 1. For where the dispatcher log is, go to Log files.

Statuses such as 404 (Not Found) or 503 (Service Unavailable) come from the GAS itself and are the same with every dispatcher, so the table does not list them. For a 503 from a web service, go to Troubleshoot error 503.

Table 1. HTTP statuses returned by httpdispatch
Status httpdispatch log message Resolution
400 Bad Request Rejecting invalid Content-Length header value: 'value' The Content-Length header is not valid, such as 12abc or +5. The client sent a request that does not follow HTTP, and the GAS has no setting for it. Check how the client builds the request.
400 Bad Request Rejecting request: invalid chunk size A chunk size in a chunked body is not valid. Refer to the resolution for 400 Bad Request (invalid Content-Length).
400 Bad Request Rejecting request: n body bytes received for a Content-Length of m More body bytes than the Content-Length value arrived together with the headers. Refer to the resolution for 400 Bad Request (invalid Content-Length).
400 Bad Request No message The HTTP version in the request line is malformed. Refer to the resolution for 400 Bad Request (invalid Content-Length).
408 Request Timeout Fetch body error when the body is incomplete. No message when the headers are incomplete. The client sent no data for the keep-alive timeout, 15 seconds by default, while httpdispatch was reading the headers or the body. Check that the client sends the complete request, and check the network between the client and the dispatcher. To allow longer pauses, start httpdispatch with the --keep-alive-timeout option.
411 Length Required Fetch body error The request has a body with neither a Content-Length header nor chunked encoding. Refer to the resolution for 400 Bad Request (invalid Content-Length).
413 Payload Too Large

Request body size n exceeds the configured limit of limit bytes (MAX_REQUEST_BODY_SIZE)

For a chunked body:

Chunked request body exceeds the configured limit of limit bytes (MAX_REQUEST_BODY_SIZE)

The body exceeds the limit. To accept larger bodies, such as file uploads, raise the limit with MAX_REQUEST_BODY_SIZE.
417 Expectation Failed Fetch body error The request has an Expect header other than 100-continue. Refer to the resolution for 400 Bad Request (invalid Content-Length).
431 Request Header Fields Too Large Request header size n exceeds the configured limit of limit bytes (MAX_REQUEST_HEADER_SIZE) The headers exceed the limit, often because of many or large cookies, or long authorization tokens. To accept larger headers, raise the limit with MAX_REQUEST_HEADER_SIZE. In the message, n is the number of bytes read when the limit was reached, not the exact header size.
500 Internal Server Error Unexpected error: code An unexpected network error occurred while the dispatcher read the request. Check the network between the client and the dispatcher, and send the request again.
501 Not Implemented No message The method is not GET, POST, PUT, DELETE, HEAD, or OPTIONS, or the request line cannot be read. Refer to the resolution for 400 Bad Request (invalid Content-Length).
505 HTTP Version Not Supported No message The HTTP version is not 1.0 or 1.1. Refer to the resolution for 400 Bad Request (invalid Content-Length).
Important:

The standalone GAS is for development only; provided to simplify your development setup and configuration. For deployment and production systems, you must include a web server.