我有Zuul代理,Eureka发现服务器和其他5个微服务。所有Spring应用程序。我需要使他们能够通过SSL进行通信。
我所做的是与每个人交换所有证书。例如,Zuul代理服务在其信任库中拥有所有6个证书。同样,我为所有其他服务做了。 这是application.yml文件。
ZUUL application.yml
server:
port: 8081
ssl:
enabled: false
key-store: classpath:ZuulServer.jks
key-store-password: password
key-alias: zuulserver
security:
require-ssl: true
spring:
application:
name: zuul-server
eureka:
client:
serviceUrl:
defaultZone: ${EUREKA_URI:https://localhost:8761/eureka}
instance:
preferIpAddress: true
zuul:
routes:
s1:
serviceId: s1
s2:
serviceId: s2
host:
socket-timeout-millis: 30000
-- EUREKA application.yml
server:
port: 8761
ssl:
enabled: true
key-store: classpath:eureka-service.jks
key-store-password: password
trust-store: classpath:eureka-service.jks
trust-store-password: password
key-alias: eureka-service
client-auth: need
类似于zuul application.yml,我配置了其他Spring服务。