inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

api-gateway 서버를 실행시키고 first-service와 second-service 를 실행시키면 api-gateway가 실행이 잘 안됩니다.

해결됨

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

안녕하세요 Spring Cloud Gateway 프로젝트 생성 강의를 진행했는데요 제가 first-service와 second-service 그리고 api-gateway를 모두 Spring Boot 2.6.10 버전 java 11 버전 sdk도 11 로 생성했습니다. 우선 api-gateway의 application.yml 파일은 다음과 같습니다. server: port: 8000 eureka: client: register-with-eureka: false fetch-registry: false service-url: defaultZone: http://localhost:8761/eureka spring: application: name: apigateway-service cloud: gateway: routes: - id: first-service uri: http://localhost:8081/ # 여기로 요청할거다 . predicates: # 조건절이다 . - Path=/first-service/** # 사용자가 이걸호출하면 위에 uri 로 간다 . 즉 http://localhost:8081/first-service/ ** 으로 간다 . - id: second-service uri: http://localhost:8082/ # 여기로 요청할거다 . predicates: # 조건절이다 . - Path=/second-service/** # 사용자가 이걸호출하면 위에 uri 로 간다 . first-service의 application.yml 파일은 다음과 같고 server: port: 8081 spring: application: name: my-first-service eureka: client: fetch-registry: false register-with-eureka: false FirstServiceController는 다음과 같습니다. @RestController @RequestMapping ( "/first-service" ) public class FirstServiceController { @GetMapping ( "/welcome" ) public String welcome () { return "Welcome to the First service" ; } } 또한 second-service의 application.yml은 다음과 같고 server: port: 8082 spring: application: name: my-second-service eureka: client: fetch-registry: false register-with-eureka: false SecondServiceController는 다음과 같습니다. @RestController @RequestMapping ( "/second-service" ) public class SecondServiceController { @GetMapping ( "/welcome" ) public String welcome () { return "Welcome to the Second service" ; } } 브라우저에 http://127.0.0.1:8081/first-service/welcome 을 입력하면 Welcome to the First service가 잘뜨고 http://127.0.0.1:8082/second-service/welcome 을 입력하면 Welcome to the Second service 가 잘 뜹니다. 그런데 http://127.0.0.1:8000/first-sevice/welcome http://127.0.0.1:8000/second-sevice/welcome 을 입력하면 역시나 동일하게 Welcome to the ~ 가 나와야하는데 Whitelabel Error Page 404 에러가 발생합니다... 원인이 무엇일까요? 참고로 api-gateway 서버를 먼저키고 first, second 켜보기도하고 first, second 서버 먼저 키고 api-gateway를 켜보기도했는데 상관없이 똑같은 에러가 발생합니다.

  • spring
  • spring-boot
  • springcloud
  • JPA
  • gateway
  • architecture
  • spring-cloud
  • Kafka
  • msa
리자몽 댓글 1 좋아요 0 조회수 1127

GlobalFilter에서 CustomFilter로 이동하는 이유

미해결

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

GlobalFilter에서 갑자기 CustomFilter로 이동하는 이유가 궁금합니다.

  • gateway
  • JPA
  • spring-cloud
  • architecture
  • spring-boot
  • msa
  • Kafka
코린이 댓글 1 좋아요 0 조회수 235

gateway 필터에서 ip주소 확인하기

미해결

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

선생님! gateway 필터에서 request한 client의 ip주소를 확인할 수 있는 방법은 없나요?

  • gateway
  • JPA
  • spring-cloud
  • spring-boot
  • architecture
  • msa
  • Kafka
코린이 댓글 1 좋아요 0 조회수 1234

인기 태그

인프런 TOP Writers

주간 인기글