Skip to content

Gateway MVC: RewritePath seems not respecting the route URI #3178

@estigma88

Description

@estigma88

Describe the bug
RewritePath seems not respecting the route URI, for instance:

spring:
  cloud:
    gateway:
      mvc:
        routes:
          - id: base
            uri: https://google.com
            predicates:
              - Path=/other/**
            filters:
              - RewritePath=/other/?(?<segment>.*), /base/$\{segment}

There, the expectation will be:

  1. Calls to http://localhost:8080/other/transcoder/v1/break
  2. Rewrite path to http://localhost:8080/base/transcoder/v1/break
  3. Change URI base to https://google.com/base/transcoder/v1/break

The third point is not happening, and the gateway calls localhost.

Sample
The following is a sample where you can find a test GatewayissueApplicationTests that passes in green, which shouldn't, as calling https://google.com/base/transcoder/v1/break must fail

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions