X-Forwarded-Prefix strip_path: false

Hi,

During the upgrade of kong from 2.2.0 to 2.3.2 we saw a difference on the X-Forwarded-Prefix. We have a custom plugin to manage this and we are doing this:

kong.service.request.set_header(“X-Forwarded-Prefix”, location)

after the upgrade this function not works and with strip_path: false the X-Forwarded-Prefix was not ended to the upstream.
After a further investigation, we find that if we use:

ngx.var.upstream_x_forwarded_prefix = location

the plugins start to work.

Any recommendation for this case?
Thanks

Kong added implicit support for the X-forwarded-Prefix header in this change. Given that Kong has done this, there are two options here:

  • The hack you noted (setting the ngx var directly)
  • Providing a custom nginx template to Kong that does not set the X-Forwarded-Prefix header (see custom nginx templates)

Note that providing a custom nginx template is a bit of a pain if you haven’t done so already, since you need to keep the template in sync as you upgrade Kong.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ