Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
estigma88 opened this issue Dec 12, 2023 · 2 comments
Closed

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

estigma88 opened this issue Dec 12, 2023 · 2 comments
Labels
Milestone

Comments

@estigma88
Copy link

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

@davidof1977
Copy link

i have the same problem, the RewritePath works fine in java configuration, but not in yaml.

@spencergibb
Copy link
Member

Thanks for the samples. In the future, please use java rather than kotlin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants