0

는 유레카 서비스 ID를 사용 zuul 노선, 서비스는 일부 httpStatus 503 개spring cloud zuul : 어떻게 서비스 httpstatus를 반환 할 수 있습니까? (또는 zuul status return을 처리 할 수 ​​있습니까?)

curl 10.1.0.21:5701/usr/users/xxx/a -H "Api-Version: v10" -i 

반환 등의 반환 경우

HTTP/1.1 503 Service Unavailable 
Set-Cookie: Session-Token=9e66fb56-21e2-457a-a00f-f788c5ce820b; path=/; domain=.0.21:5701; HttpOnly; Max-Age=2592000; Expires=Sat, 29-Oct-2016 09:23:41 GMT 
Date: Thu, 29 Sep 2016 09:23:41 GMT 
Session-Token-Expires: 2592000 
Connection: keep-alive 
ETag: 
Session-Token: 9e66fb56-21e2-457a-a00f-f788c5ce820b 
Transfer-Encoding: chunked 
Content-Type: application/json;charset=UTF-8 
X-Application-Context: user-api-provider:5701 
Content-Language: en- 
Access-Control-Max-Age: 1728000 

[{"key":"serviceUnavailable","message":"无效的接口"}] 

그러나 zuul reuturns 확인/(200), 왜? 주울이 상태를 처리하는 방법을 어떻게 바꿀 수 있습니까?

curl 10.1.0.19:8090/usr/users/xxx/a -H "Api-Version: v10" -i 

결과 :와 나를 위해

HTTP/1.1 200 OK 
Connection: keep-alive 
Content-Length: 0 
X-Application-Context: zuul-server:8090 
Date: Thu, 29 Sep 2016 09:24:10 GMT 

답변

0

작품 최신 스프링 클라우드 넷플릭스 (1.2.0) :

@SpringBootApplication 
@EnableZuulProxy 
public class SimpleApplication { 

    public static void main(String[] args) { 
     SpringApplication.run(SimpleApplication.class, args); 
    } 
} 

application.properties과 :

zuul.routes.test.url=http://httpstat.us/503 
zuul.routes.test.path=/test/** 

및 :

$ curl localhost:8080/test/ 
> GET /test/ HTTP/1.1 
> User-Agent: curl/7.35.0 
> Host: localhost:8080 
> Accept: */* 
> 
< HTTP/1.1 503 
< X-Application-Context: application 
< Cache-Control: private 
< X-AspNetMvc-Version: 5.1 
< X-AspNet-Version: 4.0.30319 
< X-Powered-By: ASP.NET 
< Access-Control-Allow-Origin: * 
< Date: Thu, 29 Sep 2016 10:24:16 GMT 
< Content-Type: text/plain;charset=utf-8 
< Transfer-Encoding: chunked 
< Connection: close 
< 
* Closing connection 0 
503 Service Unavailable$ 
+0

'spring-cloud-starter-parent'에는 버전이 일치하지 않습니까? – Dreampie

+0

'Camden.RELEASE'을 발견했습니다. 감사합니다. – Dreampie

관련 문제