当前位置: 首页 > 知识库问答 >
问题:

Spring Cloud:为Zuul和Eureka启用SSL

狄彬彬
2023-03-14

我正在尝试为我的Spring Cloud应用程序启用SSL。现在它由少数服务组成,尤里卡和祖尔(没有丝带或Feighn)。我发现很少提示如何为Eureka启用SSL,但无法使其工作。在Zuul方面,除了以下信息之外,我找不到任何信息:Zuul SSL支持,它有效地禁止使用随机端口:(server.port=0)。我的应用程序的application.yml:

server:
  port: 0
  ssl:
    key-store: classpath:keystore.jks
    key-store-password: password
    key-password: password       
endpoints:
  restart:
     enabled: true
  shutdown:
     enabled: true
  health:
    sensitive: false

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    metadataMap:
     instanceId:      ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${server.port}}}
 client:
   registryFetchIntervalSeconds: 5
  logging:
    level:
     com.netflix.discovery: 'OFF'

Eureka服务器application.yml:

    server: 
  port: 8761
  ssl:
    key-store: classpath:keystore.jks
    key-store-password: password
    key-password: password    

eureka: 
  instance:
     hostname: localhost
     securePort: ${server.port}
     securePortEnabled: true  
     nonSecurePortEnabled: false 
     secureVirtualHostName: ${spring.application.name}
     homePageUrl: https://${eureka.instance.hostname}:${server.port}/
     statusPageUrl: https://${eureka.instance.hostname}:${server.port}/admin/info

     metadataMap:
       hostname : ${eureka.instance.hostname}
       securePort: ${server.port}

  server:
    waitTimeInMsWhenSyncEmpty: 0

  client: 
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
2015-07-19 12:46:42.527  INFO 7972 --- [pool-7-thread-1] o.a.http.impl.client.DefaultHttpClient   : I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {}->http://localhost:8761: The target server failed to respond
2015-07-19 12:46:42.527  INFO 7972 --- [pool-7-thread-1] o.a.http.impl.client.DefaultHttpClient   : Retrying request to {}->http://localhost:8761

我想知道是否有任何文档说明如何在所有Netflix组件上启用SSL。

共有1个答案

岳杜吟
2023-03-14

当您为您的zuul服务(边缘代理)和eureka启用HTTPS时,我们需要在zuul服务级别使用该属性

Ribbon.isSecure:true

 类似资料:
  • 本文向大家介绍SpringCloud Eureka的使用教程,包括了SpringCloud Eureka的使用教程的使用技巧和注意事项,需要的朋友参考一下 什么是Eureka Eureka是Netfilx开源的一个用来实现微服务的注册与发现的组件。它包含Server和Client两部分。 为什么要有Eureka 例如目前有两个服务分别为服务A,服务B,我们可以在服务A调用服务B的接口地址完成调用,

  • 我刚接触spring,尝试在两个微服务之间进行通信。我创建了四个项目、、、 ProjectOne,ProjectTwo-微服务projectzuul-zuul Api gateway ProjectEureka-Eureka服务器 我试图从调用aget方法到,但总是显示java.net.UnknownHostException ProjectOne文件 Application.Properties

  • 我是SpringBoot(云)的新手,将从事一个新项目 我们的项目架构师设计了这样的新应用程序: 一个带有Angulle-2的前端Spring Boot应用程序(也是微服务)。 一个尤里卡服务器,其他微服务将连接到该服务器。 ZUUL代理服务器,它将连接到前端和镜像服务。 我需要单独的ZUUL代理服务器吗?我的意思是,使用与ZUUL服务器相同的前端应用程序的利弊是什么 MicorService-1

  • 我使用的是Spring Boot 2.0.3。由于我需要2.1.1版本中的一些新功能,我决定更新到该版本。更新后,我无法启动eureka和zuul的任何一项服务。这两个服务在编译时都没有任何错误,但在启动jar时会引发异常。我在Java 8和Java 11中都遇到了相同的错误。 我一直在寻找解决方案,但我还没有弄清楚是什么原因导致了这种情况。 我有父pom的定义: 然后分别为尤里卡和祖尔提供两项服

  • 我有一个Eureka服务器,我想在那里注册一个非常基本的SpringBoot服务。不幸的是,服务没有注册,尽管我试图跟踪所有的文章,我可以找到。 此外,当我检查DiscoveryClient的描述(得到autowired)时,我看到“Spring Cloud No-op DiscoveryClient”,它表明(根据noopDiscoveryClient.java源代码)没有找到Eureka客户机

  • 本文向大家介绍SpringCloud Eureka Provider及Consumer的实现,包括了SpringCloud Eureka Provider及Consumer的实现的使用技巧和注意事项,需要的朋友参考一下 Eureka-Provider 服务的提供者 新建一个服务提供者项目 1、导入pom文件 2、在启动类上加注解 上边那个@EnableDiscoverClient 注解加不加都行的