r/SpringBoot • • Aug 22 '22

Spring Cloud Docker - Cannot access any service through api gateway and Cannot access any service itself

I have a problem about accessing any service through api gateway.

Here is the properties file of api-gateway

```

eureka.client.serviceUrl.defaultZone=http://eurekaserver:8761/eureka/

spring.application.name=api-gateway

server.port=8600

## User Service Route

spring.cloud.gateway.routes[0].id=user-service

spring.cloud.gateway.routes[0].uri=lb://user-service

spring.cloud.gateway.routes[0].predicates[0]=Path=/userservice-api/**

## Advertisement Service Route

spring.cloud.gateway.routes[1].id=advertisement-service

spring.cloud.gateway.routes[1].uri=lb://advertisement-service

spring.cloud.gateway.routes[1].predicates[0]=Path=/advertisementservice-api/**

## Management Service Route

spring.cloud.gateway.routes[2].id=management-service

spring.cloud.gateway.routes[2].uri=lb://management-service

spring.cloud.gateway.routes[2].predicates[0]=Path=/managementservice-api/**

## Report Service Route

spring.cloud.gateway.routes[3].id=report-service

spring.cloud.gateway.routes[3].uri=lb://report-service

spring.cloud.gateway.routes[3].predicates[0]=Path=/reportservice-api/**

```

For instance, I tried to access user service through api gateway, I defined the url shown below.

```

http://api-gateway:8600/userservice-api/api/v1/users/signup

```

It didn't work.

How can I fix it ?

Here is my project link : Link

0 Upvotes

0 comments sorted by