3
server.port= 8888
spring.application.name=my-api

spring.cloud.gateway.routes[0].id = my-api
spring.cloud.gateway.routes[0].uri = https://my-api.com
spring.cloud.gateway.routes[0].predicates[0]=Path=/services/**
spring.cloud.gateway.routes[0].predicates[1]=Method=GET
spring.cloud.gateway.routes[0].filters[0]=RewritePath=/my/(?<segment>.*), /$\{segment}?d=json

I want my routes to look like this:

https://localhost:8888/my/users

and also here's a fixed query string

?d=json

so it will be like this

https://localhost:8888/my/users
https://localhost:8888/my/books

but always I get a "not found" error. Is there a way to rewrite the path to be what I want?

Because if U access the service like this:

https://localhost:8888/services/books?d=json
https://localhost:8888/services/users?d=json

it has no problem

Thanks in advance

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

0 Answers0