staticfile-buildpack: Trailing slash redirect doesn't respect protocol

What version of the buildpack you are using? 1.4.13

What was it you were attempting to do? Navigate to a path like https://example.com/something which corresponds to a folder.

What did you expect to happen? The browser would be redirected to https://example.com/something/ (trailing slash)

What was the actual behavior? The browser is redirected to http://example.com/something/ (trailing slash, http)

SSL is terminated at the router, and the original protocol is sent along in the X-Forwarded-Proto header, but this does not seem to be respected by the nginx trailing slash redirect.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

The workaround I’ve found is to set the http_strict_transport_security option in the Staticfile file configuration:

# Cloudfoundry sends redirects to http
# this property sets a header to force the browser to always use https instead
http_strict_transport_security: true