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

Loading…
Cancel
Save