spring-cloud-netflix icon indicating copy to clipboard operation
spring-cloud-netflix copied to clipboard

Zuul overwrites X-Forward-Prefix

Open speralta opened this issue 10 years ago • 2 comments

A request with a "X-Forwarded-Prefix" header is overwritten by zuul only if route has prefix, so when stripPrefix is true.

Example:

route1:
  path: /service/**
  serviceId: service
route2:
  path: /endpoint/**
  serviceId: service
  stripPrefix: false

curl on route1: curl -H "Host: example.com" -H "X-Forwarded-Prefix: /api" localhost/endpoint

{
  {},
  "_links" : {
    "self" : {
      "href" : "http://example.com/api/endpoint"
    }
  }
}

curl on route2: curl -H "Host: example.com" -H "X-Forwarded-Prefix: /api" localhost/service/endpoint

{
  {},
  "_links" : {
    "self" : {
      "href" : "http://example.com/service/endpoint"
    }
  }
}    

I expected to be http://example.com/api/service/endpoint.

Should the "X-Forwarded-Prefix" header be concatened instead of overwritten ?

speralta avatar Apr 27 '16 12:04 speralta

Seems reasonable. Are you sending a PR?

dsyer avatar Apr 28 '16 11:04 dsyer

PR is here : #994

speralta avatar Apr 28 '16 11:04 speralta