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