在本地上配置zuul代理服务器时如何使用通配符SSL证书

时间:2019-07-26 16:51:20

标签: spring-boot netflix-zuul wildcard-subdomain

我正在尝试在本地为Zuulproxy服务配置通配符CA可信证书。我的Zuul代理可以正常运行,但是运行客户端服务时出现异常com.sun.jersey.api.client.ClientHandlerException:java.net.UnknownHostException

如果我使用DNS名称为localhost的自签名证书,则一切正常。无法理解如何在本地处理通配符证书。

我的通配符受信任证书的DNS名称为* .example.com

我正在使用以下详细信息配置我的application.properties eureka.instance.hostname = localhost.example.com

eureka.instance.nonSecurePortEnabled

eureka.instance.nonSecurePortEnabled =假

eureka.instance.securePortEnabled

eureka.instance.securePortEnabled = true

eureka.instance.securePort

eureka.instance.securePort = 8761

eureka.client.registerWithEureka

eureka.client.registerWithEureka =假

eureka.client.fetchRegistry

eureka.client.fetchRegistry = false

eureka.client.serviceUrl.defaultZone

eureka.client.serviceUrl.defaultZone = https://localhost.example.com:8761/eureka

zuul代理服务器运行得很好。

客户端服务配置

eureka.client.register-with-eureka = true eureka.client.fetch-registry = true eureka.client.serviceUrl.defaultZone = https://localhost.example.com:8761/eureka eureka.client.instance.preferIpAddress = true

运行客户服务时,我遇到了异常

2019年7月26日17:20:59.040错误[main] c.n.d.s.t.d.RedirectingEurekaHttpClient-请求执行错误。 endpoint = DefaultEndpoint {serviceUrl ='https://localhost.example.com:8761/eureka/}    com.sun.jersey.api.client.ClientHandlerException:java.net.UnknownHostException:localhost.example.com     在com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187)〜[jersey-apache-client4-1.19.1.jar:1.19.1]     在com.sun.jersey.api.client.Client.handle(Client.java:652)〜[jersey-client-1.19.1.jar:1.19.1]     在com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)〜[jersey-client-1.19.1.jar:1.19.1]     在com.sun.jersey.api.client.WebResource.access $ 200(WebResource.java:74)〜[jersey-client-1.19.1.jar:1.19.1]     在com.sun.jersey.api.client.WebResource $ Builder.get(WebResource.java:509)〜[jersey-client-1.19.1.jar:1.19.1]     在com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplicationsInternal(AbstractJerseyEurekaHttpClient.java:194)〜[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplications(AbstractJerseyEurekaHttpClient.java:165)〜[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator $ 6.execute(EurekaHttpClientDecorator.java:137)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.MetricsCollectingEurekaHttpClient.execute(MetricsCollectingEurekaHttpClient.java:73)〜[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator $ 6.execute(EurekaHttpClientDecorator.java:137)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.executeOnNewServer(RedirectingEurekaHttpClient.java:118)〜[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.execute(RedirectingEurekaHttpClient.java:79)〜[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator $ 6.execute(EurekaHttpClientDecorator.java:137)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:120)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator $ 6.execute(EurekaHttpClientDecorator.java:137)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1051)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:965)上[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.DiscoveryClient。(DiscoveryClient.java:414)[eureka-client-1.9.8.jar:1.9.8]     在com.netflix.discovery.DiscoveryClient。(DiscoveryClient.java:269)[eureka-client-1.9.8.jar:1.9.8]     在org.springframework.cloud.netflix.eureka.CloudEurekaClient。(CloudEurekaClient.java:63)[spring-cloud-netflix-eureka-client-2.1.0.RELEASE.jar:2.1.0.RELEASE]     在org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration $ RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:302)[spring-cloud-netflix-eureka-client-2.1.0.RELEASE.jar:2.1.0.RELEASE]     在org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration $ RefreshableEurekaClientConfiguration $$ EnhancerBySpringCGLIB $$ fa3069a2.CGLIB $ eurekaClient $ 0()[spring-cloud-netflix-eureka-client-2.1.0.RELEASE.jar:2.1.0。发布]     在org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration $ RefreshableEurekaClientConfiguration $$ EnhancerBySpringCGLIB $$ fa3069a2 $$ FastClassBySpringCGLIB $ 5356ac8e.invoke()[spring-cloud-netflix-eureka-client-2.1.0.2.1.RASE .0.RELEASE]     在org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)[spring-core-5.1.5.RELEASE.jar:5.1.5.RELEASE]     在org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)处[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]     在org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration $ RefreshableEurekaClientConfiguration $$ EnhancerBySpringCGLIB $$ fa3069a2.eurekaClient()[spring-cloud-netflix-eureka-client-2.1.0.RELEASE.jar:2.1.0.RELEASE]     在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)〜[na:1.8.0_181]

注意:我为客户端Spring Boot应用程序创建了一个自签名证书,两者都是相互导入的。

0 个答案:

没有答案