You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: