Hi,

From Spring boot 2.6.2 When an error occurs, for example a simple 404 when no controller is registred for a path, the Content-type header is written twice. Some http clients do not support having the content-type header twice and have an error.

λ curl -v http://localhost:8080/unknown
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /unknown HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: application/json
< Content-Type: application/json
< Content-Length: 136
<
{"timestamp":"2022-01-11T13:22:29.038+00:00","path":"/unknown","status":404,"error":"Not Found","message":null,"requestId":"800357b9-1"}
* Connection #0 to host localhost left intact

This appears to be a problem created by this new behaviour of spring 5.3.14 : https://github.com/spring-projects/spring-framework/issues/27741 https://github.com/spring-projects/spring-framework/commit/2a5713f389e305300d7659887d38a89aa4e7e91e

Comment From: bclozel

Duplicates spring-projects/spring-framework#27887