Spring-cloud-netflix: zuul.stripPrefix=false not work for all route?

Created on 28 Sep 2016  Â·  9Comments  Â·  Source: spring-cloud/spring-cloud-netflix

//work fine

zuul:
  routes:
    user-api-provider:
      path: /usr/**
      stripPrefix: false
    common-api-provider:
      path: /cmn/**
      stripPrefix: false
    log-api-provider:
      path: /log/**
      stripPrefix: false
    ddcms-api-provider:
      path: /ddcms/**
      stripPrefix: false
    area-api-provider:
      path: /are/**
      stripPrefix: false
    limit-api-provider:
      path: /lmt/**
      stripPrefix: false

//not work

zuul:
  stripPrefix: false
  routes:
    user-api-provider: /usr/**
    area-api-provider: /are/**
    limit-api-provider: /lmt/**
    log-api-provider: /log/**
    common-api-provider: /cmn/**
    ddcms-api-provider: /ddcms/**
question

All 9 comments

Can you provide more details than "not work"? What do you expect and what do you see?

in second way,/usr/users forward was /users,lost /usr

zuul.stripPrefix specifically applies to zuul.prefix. zuul.routes.<route>.stripPrefix applies to zuul.routes.<route>.path

I added a note to the documentation to clarify its usage in commit 4ba3411

@ryanjbaxter there seems to be a typo in that note and it confuses the hell out of me. 😛

Please, only constructive comments. What confuses you about the documentation?

I had similar issue. Ended up with overriding Route locator logic:

@Bean
    @Primary
    public DiscoveryClientRouteLocator getRouteLocator() {
        return new DiscoveryClientRouteLocator("/", discovery, properties) {
            @Override
            protected LinkedHashMap<String, ZuulRoute> locateRoutes() {
                LinkedHashMap<String, ZuulRoute> routes = super.locateRoutes();

                routes.values().forEach(r -> r.setStripPrefix(false));

                return routes;
            }
        };
    }

It does have any effect

@spencergibb, this. ^

@elnur its fixed now

Was this page helpful?
0 / 5 - 0 ratings