【发布时间】:2020-01-21 07:39:22
【问题描述】:
我有一个 Spring Gateway 和一个 Webflux 服务。路线是;
server:
port: 9999
spring:
application:
name: discovery-service
cloud:
gateway:
routes:
- id: route1
predicates:
- Path=/1/**
uri: http://localhost:8081
filters:
- RewritePath=/1/(?<myPath>.*), /$\{myPath}
如果我请求localhost:9999/1/index.html,它会转换为localhost:8081/index.html,并且页面会正确返回。
但是,在 HTML 中,我有链接和参考,例如
<a href="/microService1">test1</a>
如何让网关返回带有更正 HREF 的 HTML? (即返回 HTML 为);
<a href="/1/microService1">test1</a>
附带说明;在包含微服务的 Webflux/Netty 服务器中托管静态 HTML、CSS 和 JS 是常见的还是公认的做法,还是应该将它们放在其他地方?
【问题讨论】:
标签: spring spring-boot spring-webflux api-gateway