fix(quickstart-gateway-service): fix route failure caused by Spring Cloud Gateway 5.x property prefix change

Spring Cloud Gateway 5.0.1 (webflux) renamed the configuration prefix from
spring.cloud.gateway.* to spring.cloud.gateway.server.webflux.*, causing the
discovery.locator and routes configuration to be ignored, so the gateway
could not forward requests (returned 404).
pull/1811/head
fishtailfu 2 months ago
parent cc0e45ea13
commit 44b7638b4b

@ -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

Loading…
Cancel
Save