From 876b1bd12cd6790e5bd738a7f513dc60c27c59dc Mon Sep 17 00:00:00 2001 From: yasasrangika Date: Wed, 7 Jun 2023 10:54:02 +0530 Subject: [PATCH] fix https://github.com/wso2/api-manager/issues/1876 --- .../wso2/carbon/apimgt/impl/internal/APIManagerComponent.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java index 9b9b0d01fe55..d43fc8a39596 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java @@ -22,6 +22,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.http.conn.ssl.DefaultHostnameVerifier; import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.ssl.SSLContexts; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; @@ -1059,7 +1060,8 @@ void populateHttpClientConfiguration() { final String[] localhosts = { "::1", "127.0.0.1", "localhost", "localhost.localdomain" }; @Override public boolean verify(String urlHostName, SSLSession session) { - return Arrays.asList(localhosts).contains(urlHostName); + return SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER.verify(urlHostName, session) + || Arrays.asList(localhosts).contains(urlHostName); } }; break;