Check both https and wss in forwarded header checks

Closes gh-27097
This commit is contained in:
Rossen Stoyanchev
2021-07-13 16:31:58 +01:00
parent 6ec7cffc93
commit e1f51cbce7
4 changed files with 18 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -239,7 +239,7 @@ public class ForwardedHeaderFilter extends OncePerRequestFilter {
int port = uriComponents.getPort();
this.scheme = uriComponents.getScheme();
this.secure = "https".equals(this.scheme);
this.secure = "https".equals(this.scheme) || "wss".equals(this.scheme);
this.host = uriComponents.getHost();
this.port = (port == -1 ? (this.secure ? 443 : 80) : port);

View File

@@ -882,7 +882,7 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
}
if (this.scheme != null && ((this.scheme.equals("http") && "80".equals(this.port)) ||
(this.scheme.equals("https") && "443".equals(this.port)))) {
((this.scheme.equals("https") || this.scheme.equals("wss")) && "443".equals(this.port)))) {
port(null);
}