Skip to content

How to include the service's context-path when the gateway forwards requests #4102

@yujunchengg

Description

@yujunchengg

Springcloud Version: 2025.0.1
spring-cloud-starter-gateway-server-webflux: 4.3.3
nacos server: 3.0.3

Configuration as follows
spring: jackson: date-format: yyyy-MM-dd HH:mm:ss time-zone: GMT+8 cloud: gateway: server: webflux: discovery: locator: enabled: true lowerCaseServiceId: true # urlExpression: "'lb://' + serviceId + metadata['contextPath']"
Even if urlExpression is configured
Still unable to forward with context path
So how should I configure it ?
My idea is if there is any configuration where I can directly read the context path value in the metadata of the Nacos service registration information, so that I don't need to manually configure the routing

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions