predicates Path 설정문제

seokseungmin·2024년 11월 3일

Today I Learned

목록 보기
9/20

predicates:
- Path=/api/v1/users/**
- Path=/login
- Path=/logout
처음에 이런식으로 path를 설정해주니 설정정보가 씹히는건지
404 Not Found가 발생했다.

HTTP/1.1 404 Not Found
Content-Type: application/json
Content-Length: 126
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 0
Referrer-Policy: no-referrer

{
  "timestamp": "2024-11-03T05:47:33.536+00:00",
  "path": "/api/v1/users",
  "status": 404,
  "error": "Not Found",
  "requestId": "6b4fd6f0-1"
}
server:
  port: 80

spring:
  cloud:
    gateway:
      globalcors:
        corsConfigurations:
          '[/**]':
            allowedOrigins: "http://localhost:3000"
            allowedMethods: "*"
            allowedHeaders: "*"
            exposedHeaders: "Authorization"
            allowCredentials: true
      routes:
        - id: user-service
          uri: http://localhost:8080
          predicates:
            - Path=/api/v1/users/**, /login, /logout  # '/api/v1/users' 및 하위 경로 포함
        # User 모듈로의 요청에는 필터를 적용하지 않음
        - id: post-service
          uri: http://localhost:8081
          predicates:
            - Path=/api/v1/posts/**, /api/v1/reviews/**, /api/v1/communities/**, /api/v1/file/**
          filters:
            - Jwt
          # post-service로의 요청에만 JwtFilter 적용

  jwt:
    secret: dlstoddmsgksqjsQnsdlslchljsdmfekgotkfwkvhrlgkwlakfwk
#eureka:
#  client:
#    register-with-eureka: true
#    fetch-registry: true
#    service-url:
#      defaultZone: http://localhost:8000/eureka/

',' 로 연결해주니 이번에는 정상 작동함.

HTTP/1.1 201 Created
transfer-encoding: chunked
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Type: application/json
Date: Sun, 03 Nov 2024 05:49:03 GMT
Referrer-Policy: no-referrer

{
  "result": "SUCCESS",
  "errors": null,
  "data": null
}
profile

0개의 댓글