Hi everyone,
our server must be able to handle requests sent with header Transfer-Encoding = Chunked, but it looks like that Undertow can’t handle them or perhaps we don’t know how to configure it properly.
We can reproduce the issue with the following steps in Microsoft Windows:
Create a new folder
Create test.cfm with only one instruction:
From Commandbox, enter that folder and type server run
Using a tool like PostMan or Bruno configure a POST call to test.cfm
Set call header Content-Type: application/x-www-form-urlencoded
Set call header: Transfer-Encoding: chunked
Add one form parameter to the call, something like param=value
Run the call
The server responds with a HTTP Status 400 and no logs is created, I tried enabling request dumping as shown in [Server logs](https://commandbox.ortusbooks.com/embedded-server/server-logs) but got no more info.
Is the issue related to Undertow or Commandbox?
Do you know how to solve it?
Apologies for the delay in posting. Our notifications from the forum weren’t working and I didn’t see this post yet.
I’m not aware of any reason why Undertow wouldn’t support chunked encoding. From my research, it does. 400 just means invalid request. Can you start the CommandBox server with the --trace flag and see if any more info shows up in the console.
Hi Brad,
thanks to your reply we found the cause and the issue is now solved.
Here’s what I did, in trace mode I saw the following Undertow error:
UT000164: Request contained invalid headers
After some googling I learned that HTTP headers Content-length and “Transfer-Encoding: Chunked” are mutually exclusive and sending both of them caused the aforementioned Undertow error.
I updated my test request in Postman and it worked perfectly.
For future readers, today Bruno doesn’t allow to not send the Content-length header, so I had to switch to Postman.