Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
larsgrefer opened this issue Apr 1, 2020 · 0 comments
Closed

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

larsgrefer opened this issue Apr 1, 2020 · 0 comments
Labels
type: bug A general bug
Milestone

Comments

@larsgrefer
Copy link
Contributor

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 1, 2020
@wilkinsona wilkinsona added this to the 2.2.x milestone Apr 6, 2020
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 6, 2020
@mbhave mbhave closed this as completed in f29bce6 May 6, 2020
@mbhave mbhave modified the milestones: 2.2.x, 2.2.7 May 6, 2020
philwebb added a commit that referenced this issue May 13, 2020
Restore the `getUseRelativeRedirects` method with a `Boolean` object
result and introduce `isUseRelativeRedirects` for the primitive boolean
variant.

See gh-20796
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants