-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Welcome file redirects do not honor the relativeRedirectAllowed option #6883
Comments
I don't quite follow your steps to reproduce. |
The servlet could just serve static files from a directory tree.
|
So, the addition of the missing slash is because as far as HTTP is concerned, a request for This distinction matters when you are using a case insensitive file system, where this is possible ...
This would mean requesting The setting Which the Perhaps the I'm a bit leery of changing the behavior of |
@joakime The main reason for the code that adds a trailing slash is for relative URLs in a welcome page to resolve properly in the browser. For example, if a docs/index.html page contains The simplest solution for this specific redirect, I think, would be to build the destination URI starting from ResourceService.java:392 could change from:
to:
In general-purpose code like |
@joakime the issue is not so much with |
The |
Fix #6883 relative welcome redirect + make all redirects able to be relative + added test for relative redirection in ResourceService Signed-off-by: Greg Wilkins <gregw@webtide.com>
PR #6883 created. Can we please review/test ASAP as we are trying to catch the current release train! |
Fix the HttpFieldsContainsHeaderValue impl Signed-off-by: Greg Wilkins <gregw@webtide.com>
Jetty version(s)
9.4.43.v20210629
Java version/vendor
(use: java -version)
openjdk version "11.0.12" 2021-07-20 LTS
OS type/version
macOS Big Sur 11.6 (20G165)
Description
Last year #5029 Relative Redirection introduced a new
relativeRedirectAllowed
option. (Thanks!) Unfortunately, at least some of the redirects that Jetty itself initiates do not yet honor that option.For instance,
org.eclipse.jetty.server.ResourceService.sendWelcome
(the method that redirects to add a missing trailing slash if necessary) builds an absolute redirect URL. Butorg.eclipse.jetty.server.Response
only honorsHttpConfiguration.isRelativeRedirectAllowed()
if the redirect URL is relative (includes no scheme).This behavior is problematic for us because in some environments, we use a reverse proxy or load balancer in front of Jetty for SSL termination. As a result, https: requests look to Jetty like http: requests, so it ends up redirecting some https: requests to http: in order to add a trailing slash.
How to reproduce?
httpConfiguration.setRelativeRedirectAllowed(true)
.The text was updated successfully, but these errors were encountered: