fix: fix route failure caused by Spring Cloud Gateway 5.x property prefix change (#1811)

2025.1
Fishtail 5 days ago committed by GitHub
parent cc0e45ea13
commit 4e02431930
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -12,3 +12,4 @@
- [fix: prepend context-path to contract reporter API paths](https://github.com/Tencent/spring-cloud-tencent/pull/1803)
- [feat: support overrideHost configuration for ratelimit, event reporter and stat modules](https://github.com/Tencent/spring-cloud-tencent/pull/1804)
- [fix: split contract base-package for springdoc scan](https://github.com/Tencent/spring-cloud-tencent/pull/1807)
- [fix: fix route failure caused by Spring Cloud Gateway 5.x property prefix change](https://github.com/Tencent/spring-cloud-tencent/pull/1811)

@ -19,22 +19,24 @@ spring:
stat:
enabled: true
gateway:
discovery:
locator:
enabled: true
'predicates[0]':
name: Path
args:
patterns: '''/'' + serviceId + ''/**'''
'filters[0]':
name: RewritePath
args:
regexp: '''/'' + serviceId + ''/(?<remaining>.*)'''
replacement: '''/$\{remaining}'''
routes:
- id: LaneRouterCallerService
uri: lb://LaneCallerService
predicates:
- Path=/LaneCallerService/**
filters:
- StripPrefix=1
server:
webflux:
discovery:
locator:
enabled: true
'predicates[0]':
name: Path
args:
patterns: '''/'' + serviceId + ''/**'''
'filters[0]':
name: RewritePath
args:
regexp: '''/'' + serviceId + ''/(?<remaining>.*)'''
replacement: '''/$\{remaining}'''
routes:
- id: LaneRouterCallerService
uri: lb://LaneCallerService
predicates:
- Path=/LaneCallerService/**
filters:
- StripPrefix=1

@ -18,13 +18,14 @@ spring:
enabled: true
port: 28085
gateway:
mvc:
routes:
- id: QuickstartCallerService
uri: lb://QuickstartCallerService
predicates:
- Path=/QuickstartCallerService/**
filters:
- StripPrefix=1
server:
webmvc:
routes:
- id: QuickstartCallerService
uri: lb://QuickstartCallerService
predicates:
- Path=/QuickstartCallerService/**
filters:
- StripPrefix=1

@ -1,8 +1,8 @@
server:
port: 48081
spring:
# profiles:
# active: context
# profiles:
# active: context
application:
name: QuickStartGatewayService
config:
@ -33,31 +33,33 @@ spring:
stat:
enabled: true
gateway:
discovery:
locator:
enabled: true
'predicates[0]':
name: Path
args:
patterns: '''/'' + serviceId + ''/**'''
'filters[0]':
name: RewritePath
args:
regexp: '''/'' + serviceId + ''/(?<remaining>.*)'''
replacement: '''/$\{remaining}'''
routes:
- id: QuickstartCallerService
uri: lb://QuickstartCallerService
predicates:
- Path=/QuickstartCallerService/**
filters:
- StripPrefix=1
- id: QuickstartCalleeService
uri: lb://QuickstartCalleeService
predicates:
- Path=/QuickstartCalleeService/**
filters:
- StripPrefix=1
server:
webflux:
discovery:
locator:
enabled: true
'predicates[0]':
name: Path
args:
patterns: '''/'' + serviceId + ''/**'''
'filters[0]':
name: RewritePath
args:
regexp: '''/'' + serviceId + ''/(?<remaining>.*)'''
replacement: '''/$\{remaining}'''
routes:
- id: QuickstartCallerService
uri: lb://QuickstartCallerService
predicates:
- Path=/QuickstartCallerService/**
filters:
- StripPrefix=1
- id: QuickstartCalleeService
uri: lb://QuickstartCalleeService
predicates:
- Path=/QuickstartCalleeService/**
filters:
- StripPrefix=1
logging:
file:
name: /sct-demo-logs/${spring.application.name}/root.log

@ -7,14 +7,16 @@ spring:
name: msgw-scg
cloud:
gateway:
discovery:
locator:
enabled: true
lower-case-service-id: false
httpclient:
# The connect timeout in millis, the default is 45s.
connectTimeout: 200
responseTimeout: 10s
server:
webflux:
discovery:
locator:
enabled: true
lower-case-service-id: false
httpclient:
# The connect timeout in millis, the default is 45s.
connectTimeout: 200
responseTimeout: 10s
consul:
enabled: true
scheme: HTTP

Loading…
Cancel
Save