Spring Boot 2.0, Zuul Gateway fails to route JSP pages which are deployed on a Non-Spring Boot Application.

Question

Please ask questions about how to use something, or to understand why something isn't working as you expect it to, on Stack Overflow using the spring-cloud tag.

Bug report Using Spring Boot 2.0 - Zuul for Gateway and Eureka for Discovery.
Our Requirement is to support gateway for Non-Spring Boot application (java web app). We had tried deploying Zuul Gateway + Eureka and Appln on Tomcat 8.0/8.5 and Jetty 9x containers.
Our test appln has 3 jsp's and an index.jsp. In web.xml we have configured in index.jsp in welcome file list so that when context is hit [ http://localhost:8080///] landing page loads.

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

Welcome page has links to subsequent pages, if click on any of those it results 404. Accessing the index.jsp by keying in complete path [ http://localhost:8080///index.jsp/ in browser also results in 404. We had tried with different combinations of URL pattern [/session/, /session/.jsp, /session/., /session//., /session//., /session/ etc.,] after registering in Eureka, all the routes are getting listed in /actuator/routes {"/session/*":"session"}

Below is my application.yml for zuul

ribbon:
   eureka:
      enabled: true

endpoints:
  restart:
    enabled: true
  shutdown:
    enabled: true
  health:
    sensitive: false
  jmx:
    unique-names: true

spring:
   application:
      name: Gateway
   jmx:
    default-domain: ${spring.application.name}

management:
  endpoints:
     web:
       exposure:
         include: info,health      
  security:
    enabled: false


server:
    port: ${GATEWAY_PORT:9484}
    use-forward-headers: true
    compression:
      enabled: true


zuul:
    debug:
      request: true
    ignoredServices: "*"
    ribbon:
      eager-load:
        enabled: true
    #prefix: /Routing
    strip-prefix: true 
    routes:
       session:
          path: /session/**
          sensitiveHeaders:
          serviceId: session
          #url: http://localhost:9050/session/
      #serviceId: http://localhost:9050/session/
          stripPrefix: false  

eureka:
   instance:
      preferIpAddress: false
   client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: ${EUREKA_URI:http://localhost:5556/Registry/eureka/}

test web app is attached. session.zip

Comment From: spencergibb

Please learn how to properly format code and logs.

Zuul has nothing to do with jsp. Your attached project isn't helpful.

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

Comment From: praveengowda25

Please find the project attached. zull requires evn variable where eureka is running. In my case it war running on tomcat instane 1 - EUREKA_URI=http://localhost:8281/Registry/eureka zuul and session project running on tomcat instance 2 - projects attached. http://:/session/index.jsp --> Loads perfectly http://:/gateway/session/index.jsp --> Fails to load with 404 error. session.zip testzuul.zip

Please find the project attached (session is non-spring web application)

Comment From: spencergibb

I'm confused as why you think /gateway/** would be routed anywhere. Your routing is behaving as you have shown configured above.

Comment From: praveengowda25

The reason why we felt /gateway/** would be routed is, when we run gateway as embedded jetty/tomcat URL [http://gatewayhost:port/session/index.jsp] loads the requested page. However, when its deployed on external tomcat /jetty it fails with 404. http://:/gateway/session/index.jsp --> Fails to load with 404 error.

Is there a way we can achieve this or the only options are: 1. Run gateway in a embedded container 2. Convert non-spring application into a Spring Boot App.

Please suggest.

fyi.. below is application.yml configuration when gateway is run on embedded jetty. session: path: /session/** sensitiveHeaders: serviceId: http://sessionapp-host:port/session/

Comment From: spencergibb

You have to add /gateway to the path in your configuration.

Comment From: praveengowda25

sorry forgot to update. We had tried with /gateway too no luck

When run on embedded container same configuration loads the required jsp whereas it fails load when deployed on an external container (weblgoic / tomcat /jetty) zuul: routes: session: path: /session/** url: http://localhost:8888/session/

Attaching the project files one more time, please check yml if anything is missing gateway.zip

session.zip

Comment From: spencergibb

Closing this due to inactivity. Please re-open if there's more to discuss.