From 42803030463cb45819848904ddb5d29495e55350 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 9 Sep 2020 15:20:21 -0500 Subject: [PATCH] Issue #5247 - Document ForwardedRequestCustomizer authority search order Signed-off-by: Joakim Erdfelt --- .../server/ForwardedRequestCustomizer.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ForwardedRequestCustomizer.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ForwardedRequestCustomizer.java index b66a9c9e4de..31c825e2698 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ForwardedRequestCustomizer.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ForwardedRequestCustomizer.java @@ -58,8 +58,76 @@ import static java.lang.invoke.MethodType.methodType; * the request came

*

Headers can also be defined so that forwarded SSL Session IDs and Cipher * suites may be customised

+ *

+ * The Authority (host and port) is updated on the {@link Request} object based + * on the host / port information in the following search order. + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Request Authority Search Order
#Value OriginHostPortNotes
1Forwarded HeaderRequiredAuthoritativeFrom left-most host=[value] parameter (see rfc7239)
2X-Forwarded-Host HeaderRequiredOptionalleft-most value
3X-Forwarded-Port Headern/aRequiredleft-most value (only if {@link #getForwardedPortAsAuthority()} is true)
4X-Forwarded-Server HeaderRequiredOptionalleft-most value
5Request MetadataOptionalOptionalfound in Request Line absolute path and/or Host client request header value as value host:port or host
6X-Forwarded-Proto Headern/astandardleft-most value as http (implied port 80) or https (implied port 443)
7X-Proxied-Https Headern/abooleanleft-most value as on (implied port 443) or off (implied port 80)
* * @see Wikipedia: X-Forwarded-For + * @see RFC 7239: Forwarded HTTP Extension */ public class ForwardedRequestCustomizer implements Customizer {