spring-cloud / spring-cloud/spring-cloud-gateway

Adding Routes Dynamically to gateway

Open
#1,259 8 comments 0 reactions 1 assignee View on GitHub

@ryanjbaxter is already working on this.

Since Aug 26, 2019.

enhancement
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

Need to add service registered with Eureka server as routes dynamically to spring cloud gateway.
Have got it working using

spring.cloud.gateway.discovery.locator.lowerCaseServiceId: true
spring.cloud.gateway.discovery.locator.enabled: true
spring.cloud.gateway.discovery.locator.predicates[0].name: Path
spring.cloud.gateway.discovery.locator.predicates[0].args[pattern]: "'/api/'+serviceId+'/**'"
spring.cloud.gateway.discovery.locator.filters[0].name: StripPrefix
spring.cloud.gateway.discovery.locator.filters[0].args[_genkey_0]: 1

Can someone help me in converting this to Java Code? Need to do this to use readBody() which we cannot do in yaml files as per https://github.com/spring-cloud/spring-cloud-gateway/issues/690

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.