toshkoprogramming
toshkoprogramming

Reputation: 53

Is it possible to make a spring gateway route case insensitive?

I need to make a predicate path of a spring gateway route case insensitive. For example, if I want to go to localhost:8888/gEt/UsErit should match my path of /get/user.

Haven't been able to find anything to make a path case insensitive.

spring:
   cloud:
      gateway:
         - id: user
           uri: localhost:8000
           predicates:
              -Path=/get/user

I expect to be able to route from localhost:8888/gEt/UsEr to localhost:8000 but don't know if there is a way to remove case sensitivity from paths.

Upvotes: 2

Views: 1404

Answers (1)

pvpkiran
pvpkiran

Reputation: 27018

It looks like it is not possible to do. please look at the documentation

Path doesn't accept regexp. But regexp can be used for queryparams, cookies and for others.

But you can specify multiple paths like this.

spring:
   cloud:
      gateway:
         - id: user
           uri: localhost:8000
           predicates:
              -Path=/get/user, /Get/User, ......

Also if you look at the PredicateSpec class, you can see that there are only two variations

public BooleanSpec path(String... patterns) {
   ....
}

public BooleanSpec path(boolean matchOptionalTrailingSeparator, String... patterns) {
   .....
}

Upvotes: 2

Related Questions