Check if scheme is localhost and fail
Fixes gh-2919
This commit is contained in:
@@ -187,9 +187,11 @@ public class Route implements Ordered {
|
||||
this.uri = uri;
|
||||
String scheme = this.uri.getScheme();
|
||||
Assert.hasText(scheme, "The parameter [" + this.uri + "] format is incorrect, scheme can not be empty");
|
||||
if (!scheme.equalsIgnoreCase("forward")) {
|
||||
Assert.hasText(this.uri.getHost(),
|
||||
"The parameter [" + this.uri + "] format is incorrect, host can not be empty");
|
||||
if (scheme.equalsIgnoreCase("localhost")) {
|
||||
// common error
|
||||
// TODO: find a general way to detect without breaking existing behavior
|
||||
throw new IllegalArgumentException(
|
||||
"The parameter [" + this.uri + "] format is incorrect, scheme can not be localhost");
|
||||
}
|
||||
if (this.uri.getPort() < 0 && scheme.startsWith("http")) {
|
||||
// default known http ports
|
||||
|
||||
Reference in New Issue
Block a user