We have a JAX-RS endpoint deployed in Wildfly 14.0.1 which returns a simple JSON.
Sometimes, the response body does not contain the JSON content, but the HTTP status and headers are written at the beginning of the response body.
I'm going to clarify the problem with an example.
This is the correct response stream:{}
HTTP/1.1 200 OK Connection: keep-alive Content-Length: 156 Content-Type: application/json Date: Tue, 10 Jan 2023 16:34:04 GMT {"outcome":"0","description":"The service completed successfully","emsResult":{"outcomeCode":"0","outcomeDescription":"The service completed successfully"}}
{}But sometimes this response is read:
HTTP/1.1 200 OK Connection: keep-alive Content-Length: 156 Content-Type: application/json Date: Tue, 10 Jan 2023 16:34:10 GMT HTTP/1.1 200 OK Connection: keep-alive Content-Length: 156 Content-Type: application/json Date: Tue, 10 Jan 2023 16:34:10 GMT mpleted successfully"}}
We verified the problem using tcpdump, in order to be sure that this is not a client reading problem, but the response above is actually produced by the server.
It seems that when the response stream is written, the buffer is somehow reset and the body content is overwritten with the HTTP status and headers. Note that after the duplicated HTTP status and Headers there is the last part of the JSON.
Thanks in advance.
- account is impacted by
-
UNDERTOW-2226 Response Body contains HTTP Status and headers
-
- Closed
-
antonio.derrico@tasgroup.it We are marking it as Cannot Reproduce for now. If you have further information to provide on latest WildFly/Unddertow, we will reopen it and have a look again. Thanks!