I’m surely not the only one using Kong in front of a JSON API like on the homepage here: http://jsonapi.org/
But I want to do something like router from
Therefore I have to strip_path.
But I need to provide a
links property in my api response that SHOULD contain the
Any suggestions? Is that a clear example?
In this case, you need to send the
ngx.var.request_uri within the upstream request somehow (e.g. within a header):
# request made by Kong
GET /v1.0/widgets HTTP/1.1
For this, you have two solutions:
- Write your own custom plugin (simply grabbing that value and inserting it in a header of the upstream request. It is fairly trivial to do, if you are familiar with custom plugins (see the Plugin Development Guide).
- If you have an Enterprise Edition subscription, you can use the EE request transformer plugin, which lets you inject values into the upstream request via templates you can define in the plugin’s configuration. The EE edition has a free trial period: https://konghq.com/kong-enterprise-edition/
Hope that helps,