spring cloud zuul: return 如何服务 httpstatus(或处理 zuul 状态 return)?

spring cloud zuul: How can return service httpstatus(or handle zuul status return)?

如果使用 zuul 路由作为 eureka 服务 id,服务 return 一些 httpStatus 像 503

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

Returns:

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 返回 ok/200,为什么?我怎样才能改变 Zuul 处理状态的方式?

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

Returns:

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

适用于最新的 spring-cloud-netflix (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$