0

We are trying to override the default error page you get when there is a routing failure within the Zuul Edge Server and aren't having any luck. We have routes set up like so:

zuul:
  routes:
    ui: /**
    api: /api/**

The default SendErrorFilter attempts to send the request to /error by default and that works when the ui service is up and running as it will serve up /error. But the problem is when the ui server is down, it tries to route to /error and fails. You then get the big nasty exception on your screen saying there was a forwarding error and no fallback was available.

com.netflix.zuul.exception.ZuulException: Forwarding error
    org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:140)
    org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:105)
    com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112)
    com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197)
    com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:161)
    com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:120)
    com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:84)
    com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:111)

Root Cause:
    com.netflix.hystrix.exception.HystrixRuntimeException: uiRibbonCommand failed and no fallback available.
    com.netflix.hystrix.AbstractCommand$16.call(AbstractCommand.java:807)
    com.netflix.hystrix.AbstractCommand$16.call(AbstractCommand.java:794)
    rx.internal.operators.OperatorOnErrorResumeNextViaFunction$1.onError(OperatorOnErrorResumeNextViaFunction.java:77)
    rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70)
    rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70)
    rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70)
    com.netflix.hystrix.AbstractCommand$DeprecatedOnFallbackHookApplication$1.onError(AbstractCommand.java:1516)
    com.netflix.hystrix.AbstractCommand$FallbackHookApplication$1.onError(AbstractCommand.java:1406)
    com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:314)
    com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:306)

How do you set a default Fallback in Zuul to handle these errors so the user doesn't see the nasty exception? I have seen this open issue on spring-cloud-netflix (#250), but I would deal with a default fallback for all routes, not just specific routes. What is the correct way to do this?

Andrew Serff
  • 2,117
  • 4
  • 21
  • 32
  • 1
    Do you want a default fallback or a custom error? Because you mapped a default route `/**` you've lost `/error`. You can turn off the error page via `server.error.whitelabel.enabled=false`. http://docs.spring.io/spring-boot/docs/current/reference/html/howto-actuator.html#howto-customize-the-whitelabel-error-page – spencergibb Sep 29 '16 at 18:09
  • We want to provide a custom 500 error html page. So I thought we could make a fallback that returns a view from the edge server, but can't figure out how. – Andrew Serff Sep 29 '16 at 19:43
  • fallbacks are not supported in zuul. You could write a post filter. – spencergibb Sep 30 '16 at 18:22

1 Answers1

2

Fallbacks are now supported in the latest release of Spring cloud. Please review the post - Fallback methods at Zuul server in Spring cloud for additional details

Community
  • 1
  • 1
vasanth
  • 81
  • 7