문서의 이전 판입니다!
/orders/<userId>
는 로그인을 했을 경우라도, 로그인 사용자가 아닌 다른 사용자 ID로 API 요청을 할 수 있기 때문이다./orders
API Endpoint만 노출하고 로그인 세션에서 ID값을 읽고 이를 다시 backend에 /orders/<userId>
로 넘겨주는 방식을 취해야 한다.serviceId
는 필요에 따라.zuul: routes: myserver_mypath: path: /mypath/** url: .... serviceId: myserver myserver_another_path: path: /anotherpath/** url: ... serviceId: myserver
/actuator/routes
management.endpoints.web.exposure.include=routes
처럼 지정해 줘야 활성화 됨. 혹은 *
* 'org.springframework.cloud.netflix.zuul.filters.support.FilterConstants#SERVICE_ID_KEY'' 사용
@Override public boolean shouldFilter() { RequestContext context = RequestContext.getCurrentContext(); return "member-api".equals(context.get(SERVICE_ID_KEY)); }