Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

springboot microservices gatewayservice routing issue #15

Open
deepak-Jenkins opened this issue Apr 11, 2022 · 0 comments
Open

springboot microservices gatewayservice routing issue #15

deepak-Jenkins opened this issue Apr 11, 2022 · 0 comments

Comments

@deepak-Jenkins
Copy link

Environment Detail:
spring boot version 2.6.6
spring-cloud-gateway-server 3.1.1.jar

Configuration in application.properties:
spring.cloud.gateway.discovery.locator.enabled=true
spring.cloud.gateway.discovery.locator.lowerCaseServiceId=true

Port Detail:
ProductGatewayService: 5069
PssTitleService: 5071

With the above set up If I am invoking the below url I am getting proper response.
http://localhost:5069/psstitleservice/api/productService/getTitleData - working fine

In actual scenario: I am having a context path with my gateway service. /cmdgservices
With the context path, I have tried many things but none of the below way is working.

Way 1 :
spring.cloud.gateway.discovery.locator.predicates[0].name: Path
spring.cloud.gateway.discovery.locator.predicates[0].args[pattern]: "'/'+psstitleservice+'/**'"

Way 2 :
spring.cloud.gateway.discovery.locator.predicates[0].name: Path
spring.cloud.gateway.discovery.locator.predicates[0].args[pattern]: "'cmdgservices/'+psstitleservice+'/**'"

Way 3 :
spring.cloud.gateway.discovery.locator.predicates[0].name: Path
spring.cloud.gateway.discovery.locator.predicates[0].args[pattern]: "'cmdgservices/'+psstitleservice+'/**'"
spring.cloud.gateway.discovery.locator.url-expression: 'lb://'+psstitleservice

Way 4 (In Java configuration):
@configuration
public class ApiGatewayConfiguration {
@bean
public RouteLocator gatewayRouter(RouteLocatorBuilder builder) {
return builder.routes()
.route("test_route", p -> p.path("/psstitleservice")
.uri("http://localhost:5071"))
.build();
}

I have already invested 3 days behind it. I would be grateful to any helping hand. Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant