Closed
Description
Not sure if this belongs in Boot or Framework or somewhere else..
Spring Boot version: 3.0.7
If my Spring Boot application is behind a proxy, and I've configured the X-Forwarded-* headers to be sent, and the Boot application is configured with server.forward-headers-strategy=FRAMEWORK
, I would expect the path
attribute in the default error response to reflect the forwarded path prefix, but it does not.
I have an extremely simple reproduction application at https://github.com/bpfoster/spring-boot-error-path-forwarded-prefix
Actuator includes the path prefix as expected:
$ curl http://localhost:8081/actuator -H 'X-Forwarded-Prefix: /api' | jq
{
"_links": {
"self": {
"href": "http://localhost:8081/api/actuator",
"templated": false
},
"health": {
"href": "http://localhost:8081/api/actuator/health",
"templated": false
},
"health-path": {
"href": "http://localhost:8081/api/actuator/health/{*path}",
"templated": true
}
}
}
The error response does not:
$ curl http://localhost:8081/foobar -H 'X-Forwarded-Prefix: /api' | jq
{
"timestamp": "2023-06-22T12:29:30.173+00:00",
"status": 500,
"error": "Internal Server Error",
"message": "Foobar",
"path": "/foobar"
}
Note the href
s in actuator include the X-Forwarded-Prefix value vs the path
in the error do not.