For reporting, my application transfer data via URI, in some cases, it'll make the URI very long (GET request) (example: ~15.000 characters encoded).
In this situation, I test with differences proxy as below:
nginx-ingress
in GKE: the client is not receive response from web server, also no log found in nginx-ingress
(added annotations: nginx.ingress.kubernetes.io/large-client-header-buffers: "4 16k"
and nginx.ingress.kubernetes.io/client-body-buffer-size: "5m"
)nginx
run on VM: OK (added in config: large_client_header_buffers 4 16k;
Because there is no log info in nginx-ingress
service, I think the connection may be dropped by Google firewall or something else before it can come to nginx-ingress
.
How can I debug in this case to find the problem? Are there any documents about the URL length allowed in GKE?
You are using 15000 characters which are highly larger due to this GET request cannot hit the logs. As per Google Cloud official doc,
The URL has a practical length limitation, typically between 2k to 8k. It's enforced by some browsers and proxies. If your API uses GET requests with URLs that exceed the length limitation, such requests may be rejected by browsers. To bypass the limitation, the client code should use a POST request with Content-Type of application/x-www-form-urlencoded along with HTTP header X-HTTP-Method-Override: GET. This approach also works for DELETE requests.
So, by this use POST request instead of GET generally POST will take higher value. It allows you to send data to the request body instead of URI. Refer to doc for more information.
Or Try by adding the below snippet in the Ingress controller yaml and have a check this is one of the work around :
nginx.ingress.kubernetes.io/server-snippet: | http2_max_header_size 256k; http2_max_field_size 256k;
There is currently an existing feature request for increasing this length; this will change in the near future. You can 'star' the issue to get further updates and/or provide your use case in the comments.