From ccf8f86c8dfb9acd2b8c0166bd13a72b0ce4b233 Mon Sep 17 00:00:00 2001 From: Rico Pahlisch Date: Wed, 31 May 2017 12:04:09 +0200 Subject: [PATCH] use only default https ports for https check spring boot uses all high ports and there are some trouble if ports end with 443 (e.g. 24443, ...) --- .../cloud/netflix/ribbon/DefaultServerIntrospector.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/DefaultServerIntrospector.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/DefaultServerIntrospector.java index a228544f..8c9053d6 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/DefaultServerIntrospector.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/DefaultServerIntrospector.java @@ -16,7 +16,9 @@ package org.springframework.cloud.netflix.ribbon; +import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Map; import com.netflix.loadbalancer.Server; @@ -25,10 +27,11 @@ import com.netflix.loadbalancer.Server; * @author Spencer Gibb */ public class DefaultServerIntrospector implements ServerIntrospector { + private static final List SECURE_PORTS = Arrays.asList(443, 8443); + @Override public boolean isSecure(Server server) { - // Can we do better? - return (""+server.getPort()).endsWith("443"); + return SECURE_PORTS.contains(server.getPort()); } @Override