当前位置:   article > 正文

springboot gateway转发websocket的配置_springboot gateway转发ws

springboot gateway转发ws

① Spring Boot集成WebSocket的maven依赖:

<dependency>

     <groupId>org.springframework.boot</groupId>

     <artifactId>spring-boot-starter-websocket</artifactId>

</dependency>

②gateway 的application.yml配置

server:
  port: 8888
  
spring:
  application:
    name: gateway
    
  cloud:
    gateway:              
      discovery:
        locator:
          enabled: true
          lowerCaseServiceId: true

      routes:
        - id: service
          uri: lb://SERVICE
          predicates:
            - Path=/test/**
          filters:
            - StripPrefix=1

③gateway全局过滤器配置

@Configuration
public class CustomFilterConfig {
    
    @Bean
    public RequestGlobalFilter customGlobalFilter (){
        return new R

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/858209
推荐阅读
相关标签
  

闽ICP备14008679号