, и я пытаюсь настроить шлюз API. Проблема в том, что когда я отправляю запрос http: // localhost: 8080/api/test/hey -> 404, когда я пишу http: // localhost: 8081/api/test/hey 200. Я не могу найти ошибку. Мой код:
Введите описание изображения здесь
Введите описание изображения здесь < /p>
`< /p>
Код: Выделить всё
@RestController< /code>
@RequestMapping("/api/auth")< /code>
public class AuthController {}Код: Выделить всё
@RestController< /code>
@RequestMapping("/api/test")< /code>
public class TestController {< /code>
@GetMapping("/hey")< /code>
public String haveYouAccess(){< /code>
return "you have access";< /code>
}}Код: Выделить всё
spring.application.name=api-gateway< /code>
server.port=8080< /code>
eureka.client.service-url.defaultZone=``http://localhost:8761/eureka/Код: Выделить всё
spring.cloud.gateway.discovery.locator.enabled=false< /code>
spring.cloud.gateway.discovery.locator.lower-case-service-id=trueКод: Выделить всё
spring.cloud.gateway.routes[0].id=user-service-ax< /code>
spring.cloud.gateway.routes[0].uri=lb://user-service< /code>
spring.cloud.gateway.routes[0].predicates[0]=Path=/api/auth/**Код: Выделить всё
spring.cloud.gateway.routes[1].id=user-test< /code>
spring.cloud.gateway.routes[1].uri=lb://user-service< /code>
spring.cloud.gateway.routes[1].predicates[0]=Path=/api/test/**Код: Выделить всё
I tried to write like that, but nothing worked. If you can fix the error, please also explain which way I need to make a request to postman.< /code>
spring.cloud.gateway.routes[1].id=user-test< /code>
spring.cloud.gateway.routes[1].uri=lb://user-service< /code>
spring.cloud.gateway.routes[1].predicates[0]=Path=/api/test/**< /code>
spring.cloud.gateway.routes[1].filters[0]=StripPrefix=1`Подробнее здесь: https://stackoverflow.com/questions/796 ... pring-boot