Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Cloud Hoxton SR5: Route ordering not maintained even with YML configuration #3825

Closed
bhattankit opened this issue Jun 22, 2020 · 1 comment

Comments

@bhattankit
Copy link
Contributor

Describe the bug
Prior to Hoxton SR5, routes configured in application.yml were evaluated in the order defined in the configuration file.

With SR5, the order doesn't seem to be honored causing legacy routes to get picked up before specific routes.

Sample
Below is a sample output of routing matching for the same route in SR4 and SR5. Route in both cases is /appui/smartBanner.js

SR4

[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,187 DEBUG SimpleRouteLocator []: Matching pattern:/gateway/*hird-party/**
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,189 DEBUG SimpleRouteLocator []: Matching pattern:/gateway/**
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,189 DEBUG SimpleRouteLocator []: Matching pattern:/health
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,189 DEBUG SimpleRouteLocator []: Matching pattern:/appapis/featureregistry/**
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,191 DEBUG SimpleRouteLocator []: Matching pattern:/appapis/getaccountbyid/**
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,192 DEBUG SimpleRouteLocator []: Matching pattern:/appapis/accounts/**
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,192 DEBUG SimpleRouteLocator []: Matching pattern:/appapis/upcoming-transactions/**
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,192 DEBUG SimpleRouteLocator []: Matching pattern:/appapis/customer-addresses/**
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,193 DEBUG SimpleRouteLocator []: Matching pattern:/appapis/accountsummary
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,193 DEBUG SimpleRouteLocator []: Matching pattern:/appapis/customer/cookie
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,193 DEBUG SimpleRouteLocator []: Matching pattern:/appui/**
[http-nio-8443-exec-1] 19 Jun 2020 12:08:46,196 DEBUG SimpleRouteLocator []: route matched=ZuulRoute{id='appui', path='/appui/**', serviceId='null', url='https://testsample.com/', stripPrefix=false, retryable=null, sensitiveHeaders=[], customSensitiveHeaders=false, }

SR5

http-nio-8443-exec-1] 19 Jun 2020 12:18:22,761 DEBUG SimpleRouteLocator []: Matching pattern:/gateway/**
[http-nio-8443-exec-1] 19 Jun 2020 12:18:22,762 DEBUG SimpleRouteLocator []: Matching pattern:/appapis/accountsummary
[http-nio-8443-exec-1] 19 Jun 2020 12:18:22,762 DEBUG SimpleRouteLocator []: Matching pattern:/appapis/customer/cookie
[http-nio-8443-exec-1] 19 Jun 2020 12:18:22,762 DEBUG SimpleRouteLocator []: Matching pattern:/index.html
[http-nio-8443-exec-1] 19 Jun 2020 12:18:22,762 DEBUG SimpleRouteLocator []: Matching pattern:/*/*
[http-nio-8443-exec-1] 19 Jun 2020 12:18:22,763 DEBUG SimpleRouteLocator []: route matched=ZuulRoute{id='catchall', path='/*/*', serviceId='null', url='https://testsample.com/', stripPrefix=false, retryable=null, sensitiveHeaders=[], customSensitiveHeaders=false, }

application.yml

zuul:
  decodeUrl: false
  forceOriginalQueryStringEncoding: true
  sensitiveHeaders: Cookie,Set-Cookie,Origin
  ignoredHeaders: Access-Control-Allow-Origin
  ignoreSecurityHeaders: false

  # Note that the order below is important for the endpoint to match the correct route.
  # Ex. Partner is before Internal so that /third-party is not picked up by /**.
  routes:
    partner:
      path: /gateway/*hird-party/**

    internal:
      path: /gateway/**

    health:
      path: /health
      strip-prefix: false

    appapisregistry:
      path: /appapis/featureregistry/**

    appapisgetaccountbyid:
      path: /appapis/getaccountbyid/**

    appapistransactions:
      path: /appapis/accounts/**

    appapisupcomingtransactions:
      path: /appapis/upcoming-transactions/**

    appapisaddress:
      path: /appapis/customer-addresses/**

    appapissummary:
      path: /appapis/accountsummary
      strip-prefix: false

    appapiscookie:
      path: /appapis/customer/cookie
      strip-prefix: false

    appui:
      path: /appui/**
      strip-prefix: false

    appweb:
      path: /appweb/**
      strip-prefix: false

    appindex:
      path: /index.html
      strip-prefix: false

    # Note: This must be the last route configured as it is a catch all.
    catchall:
      path: /*/*
      strip-prefix: false
@bhattankit
Copy link
Contributor Author

Resolved by: spring-projects/spring-boot#21470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants