Skip to content

Allow custom ErrorReportValve to be used with Tomcat and provide whitelabel version #21257

Open
@patst

Description

@patst

During a penetration test one finding was the information disclosure of using a Tomcat webserver.

If a request with an invalid URL (e.g. http://localhost:8080/[test ) is executed the configured custom error pages are not used.
Instead the embedded Tomcats ErrorReportValve is used and presents a default Tomcat Error page.

It is possible to configure it to some extends using

  • server.error.whitelabel.enabled=false
  • server.error.include-stacktrace=never

But the default HTTP Status 400 page is always returned.

It is possible to create a custom ErrorReportValve and set the properties like errorCode.400 to create a custom page, but this configuration is not possible with an application.properties file.

(At least as far as I can see)
See an example project at https://github.com/patst/tomcat-errorvalve

Maybe it would be a good idea to expose the properties for configuration.

The ErrorReportValve is created at

private void customizeErrorReportValve(ErrorProperties error, ConfigurableTomcatWebServerFactory factory) {

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions