content: package com.example;
  
  import org.springframework.cloud.netflix.zuul.filters.route.FallbackProvider;
  import org.springframework.http.HttpHeaders;
  import org.springframework.http.HttpStatus;
  import org.springframework.http.MediaType;
  import org.springframework.http.client.ClientHttpResponse;
  import org.springframework.stereotype.Component;
  
  import java.io.ByteArrayInputStream;
  import java.io.InputStream;
  
  /**
   * @author Alejandro Duarte.
   */
  @Component
  public class CustomFallbackProvider implements FallbackProvider {
  
      @Override
      public String getRoute() {
          return "admin-application";
      }
  
      @Override
      public ClientHttpResponse fallbackResponse(String route, Throwable cause) {
          return new ClientHttpResponse() {
              @Override
              public HttpStatus getStatusCode() {
                  return HttpStatus.NOT_FOUND;
              }
  
              @Override
              public int getRawStatusCode() {
                  return getStatusCode().value();
              }
  
              @Override
              public String getStatusText() {
                  return getStatusCode().getReasonPhrase();
              }
  
              @Override
              public void close() {
              }
  
              @Override
              public InputStream getBody() {
                  return new ByteArrayInputStream("Server not available. Please, try again later.".getBytes());
              }
  
              @Override
              public HttpHeaders getHeaders() {
                  HttpHeaders headers = new HttpHeaders();
                  headers.setContentType(MediaType.APPLICATION_JSON);
                  return headers;
              }
          };
      }
  
  }
  