我想在spring cloud gateway上路由我的websocket-service
作为spring cloud gateway的文档,我尝试这样做,并且成功了:
spring:
cloud:
gateway:
routes:
- id: websocket-sockjs-route
uri: http://localhost:8085
predicates:
- Path=/websocket/info/**
- id: websocket_route
uri: ws://localhost:8085
predicates:
- Path=/websocket/**但是当我尝试这个的时候,它不起作用:
spring:
cloud:
gateway:
routes:
- id: websocket-sockjs-route
uri: http://websocket-service:8085
predicates:
- Path=/websocket/info/**
- id: websocket_route
uri: ws://websocket-service:8085
predicates:
- Path=/websocket/**我想让我的websocket路由变成这样:
spring:
cloud:
gateway:
routes:
- id: hello-world-route
uri: lb://hello-world:8081
predicates:
- Path=/hello发布于 2019-08-13 09:28:56
你可以看看这个问题:gateway
它应该是这样工作的:
spring:
cloud:
gateway:
routes:
- id: websocket-sockjs-route
uri: http://websocket-service
predicates:
- Path=/websocket/info/**
- id: websocket_route
uri: lb:ws://websocket-service
predicates:
- Path=/websocket/**如果您使用discovery client,则不需要设置端口,只需使用服务名称。
https://stackoverflow.com/questions/56318478
复制相似问题