Skip to content

Unclear default for 'server.tomcat.use-relative-redirects' #20796

Closed
@larsgrefer

Description

@larsgrefer

The property server.tomcat.use-relative-redirects (backed by the field org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat#useRelativeRedirects) has no declared default value. In addition to that, the code which reads the property in org.springframework.boot.autoconfigure.web.servlet.TomcatServletWebServerFactoryCustomizer#customize only applies something to the tomcat context, if an explicit value is configured.

Given this defensive approach I'd expect to get the tomcat default, if no value is configured, but this isn't the case.

org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory#prepareContext explicitly sets this to false.

I'd suggest to either

  • not set a value in org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory#prepareContext in order to use tomcat's default behaviour or
  • change the type of org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat#useRelativeRedirects from Boolean(boxed) to boolean(unboxed/primitive) and make the default value of false more explicit.

see also: #10597 and #4715

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions