Gateway網關支持https


一 把證書拷在該目錄下

  

 

 

二 yml配置注意路由配置,網關內部通過http協議調用服務

  

spring:
  application:
    name: getway
  cloud: #配置SpringCloudGateway的路由
    gateway:
      discovery:
        locator:
          enabled: true
          lower-case-service-id: true # 服務名小寫
      routes:
        - id: nacos-provide  #路由的ID,沒有固定規則但求唯一,建議配合服務名
          uri: lb:http://nacos-provide # 匹配后提供服務的路由地址,lb代表從注冊中心獲取服務,且以負載均衡方式轉發
          predicates:
            - Path=/nacos-provide/** #斷言,路徑相匹配的進行路由
    nacos:
       discovery:
        server-addr: localhost:8848
  datasource:
    username: root
    password: 123
    url: jdbc:mysql://localhost:3306/cloud
    driver-class-name: com.mysql.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource
mybatis-plus: 
    configuration : 
      map-underscore-to-camel-case : true
      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    mapper-locations: classpath:mapper/*.xml 
    
    
server:
   port: 9000
   ssl: #添加的ssl自簽名證書
    key-store: classpath:keystore.p12 #注意路徑要配置正確
    key-store-password: 123456
    keyStoreType: PKCS12
    keyAlias: tomcat
  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM