[
https://issues.apache.org/jira/browse/CXF-8154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16972956#comment-16972956
]
Andriy Redko commented on CXF-8154:
-----------------------------------
Hi [~pioto],
If I remember correctly, this issue has nothing to do with CXF but the web
server / container of your choice. I assume you are using Tomcat which does
strip the reason phrase from the response (please check [1] for relevant
discussion), for example:
{noformat}
$ curl http://localhost:19091/services/catalog/errors -i
HTTP/1.1 500
Date: Wed, 13 Nov 2019 02:10:52 GMT
Content-Type: application/json
Content-Length: 240
Connection: close {noformat}
Running the same code on Undertow:
{noformat}
$ curl http://localhost:19091/services/catalog/errors -i
HTTP/1.1 500 Internal Server Error
Connection: keep-alive
Content-Type: application/json
Content-Length: 240
Date: Wed, 13 Nov 2019 02:09:11 GMT {noformat}
Or Jetty:
{noformat}
$ curl http://localhost:19091/services/catalog/errors -i
HTTP/1.1 500 Server Error
Date: Wed, 13 Nov 2019 02:13:44 GMT
Content-Type: application/json
Content-Length: 240 {noformat}
Hope it helps, thanks!
[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60362
> No "Reason Phrase" Sent with HTTP Responses
> -------------------------------------------
>
> Key: CXF-8154
> URL: https://issues.apache.org/jira/browse/CXF-8154
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 3.3.4
> Environment: Apache Tomcat 8.5, OpenJDK 1.8
> Reporter: Mike Kelly
> Priority: Minor
>
> When I throw, for example, a {{javax.ws.rs.NotFoundException}}, my
> expectation is that the response would start with a Status Line like:
> {noformat}
> HTTP/1.1 404 Not Found
> {noformat}
> However, I just get a response like:
> {noformat}
> HTTP/1.1 404
> {noformat}
> This seems to be true both if I provide a {{message}} when I construct the
> exception, or if I use the no argument constructor.
> This is similarly true for any exceptions triggered internally by CXF, for
> example if I make a request with an unsupported method. The stack trace in my
> logs shows a {{javax.ws.rs.ClientErrorException: HTTP 406 Not Acceptable}},
> but the response just shows {{HTTP/1.1 406}}.
> My expectation is that either the appropriate default "reason phrase", or the
> {{message}} I provided to my constructed exception, would be returned to the
> caller?
> My reading of RFC 2616 is that such a reason phrase is not optional:
> https://tools.ietf.org/html/rfc2616#section-6.1
--
This message was sent by Atlassian Jira
(v8.3.4#803005)