I have this yml where I define the routes for Spring Cloud Gateway
spring:
cloud:
gateway:
routes:
- id: auth_external_rewrite_path
uri: lb://<service-1>
predicates:
- Path=/mypath1
filters:
- RewritePath=/mypath1, /myrewritepath1
- id: auth_federated_login_rewrite_path
uri: lb://<service-2>
predicates:
- Path=/mypath2
filters:
- RewritePath=/mypath2, /mypathrewrite2
As you can see I use the lb uri beacuse services behind these uri are discovered through an Eureka Server dynamically.
The question is: how can I block requests that aren't defined into the yaml ?
For example: a request to http://host/service-1 should pass but a request to http://host/service-not-definied-in-my-yaml should not be forwarded by the gateway