Closed emmdurin closed 3 months ago
poke @groldan I think DT's request is similar to what is intended here.
Also, as discussed in our meeting, it'd be great if this filter could be enabled through a config property, being disabled by default
either way, whether it's enabled or disabled by default, just make sure to add an entry in the security docs
We wanted to show a standardized error page when an application behind the gateway returns an HTTP 4xx or 5xx error, instead of an application specific error page.
It uses error pages templates embedded in gateway or overriden in
gateway/template/error
directory of datadir.To enable it globally, add this to
gateway/application.yaml
of datadir :To enable it only on some routes, add this to concerned routes in
gateway/routes.yaml
of datadir :A side effect that can be discussed is that it prints a stack trace in gateway log as implementation throws an exception. Some things can be done differently, like using a more specific exception class, or catch it in a
AbstractErrorWebExceptionHandler
subclass to maybe avoid to print it in log, or do not throw an exception but replace content of response by content of500.html
template. Suggestions are welcome.Example of log with printed stacktrace :