unit icon indicating copy to clipboard operation
unit copied to clipboard

Long URL (10000 chars) ends with HTTP error 431 - how to increase limit?

Open JanMikes opened this issue 3 years ago • 1 comments

Hi!

We need to proceed long URL (10.000 charactes), but it is ending up with 431 error.

I believe it is caused by this condition: https://github.com/nginx/unit/blob/2348229dc7656f36a7915d85af56aae9ed9fb120/src/nxt_h1proto.c#L716

Is there any way how to increase these limits? I have not found this settings in documentation.

FYI request with 8200 chars long URL passes without any issues :-).

Thank you.

JanMikes avatar Jan 26 '21 09:01 JanMikes

Currently it's not possible to change without recompilation. The value is hardcoded and can only be changed in sources:

diff --git a/src/nxt_router.c b/src/nxt_router.c
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -1678,7 +1678,7 @@ nxt_router_conf_create(nxt_task_t *task,
 
             // STUB, default values if http block is not defined.
             skcf->header_buffer_size = 2048;
-            skcf->large_header_buffer_size = 8192;
+            skcf->large_header_buffer_size = 8192 * 2;
             skcf->large_header_buffers = 4;
             skcf->discard_unsafe_fields = 1;
             skcf->body_buffer_size = 16 * 1024;

VBart avatar Feb 01 '21 14:02 VBart

Two new settings (undocumented and subject to change) have been merged.

  • large_header_buffer_size

In simple terms, determines the maximum size of any single header value (including the request line). Defaults to 8192 bytes.

  • large_header_buffers

Number of the above available. Defaults to 4.

ac000 avatar Dec 13 '22 14:12 ac000