0

Let's suppose I have these functions mapped to web on port 8080:

/uppercase
/toChars

I can get the data from them using:

curl -d '["test"]' localhost:8080/uppercase,toChars -H "Content-Type: application/json"

Now I created a route using gateway to map on:

/uppercase,toChars

But when I run the curl as above(changing the port to 8081 since gateway is on 8081), it doesn't give me back the requested information. I also tried /uppercase|toChars. Here is the definition that I am using:

spring:
  cloud:
    gateway:
      routes:
        - id: app8080
          uri: http://localhost:8080
          predicates:
            - Path=/uppercase,/toChars

I have tried the different combinations of Path but none of them worked. Any help?

  • `Path=/uppercase,/toChars` means `/uppercase` or `/toChars`. You'll need to use the verbose configuration https://cloud.spring.io/spring-cloud-static/spring-cloud-gateway/2.2.2.RELEASE/reference/html/#fully-expanded-arguments – spencergibb Jun 01 '20 at 15:33
  • @spencergibb I tried writing the regexp but I am not able to create a sensible route. Could you please write an answer to clarify it. I want to map to `/uppercase,toChars`. –  Jun 01 '20 at 15:48
  • 1
    Do it with builder: `...route("someid", r -> r.alwaysTrue().and().path("/uppercase,toChars").uri("http://localhost:8080"))...` – Aniket Sahrawat Jun 01 '20 at 16:20

0 Answers0