# Need to strip\_path but also want original uri

**URL:** <https://discuss.konghq.com/t/need-to-strip-path-but-also-want-original-uri/906>\
**Category:** General\
**Created:** [May 1, 2018, 10:41pm UTC](https://discuss.konghq.com/t/need-to-strip-path-but-also-want-original-uri/906 "2018-05-01T22:41:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![morgs32](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@morgs32](https://discuss.konghq.com/u/morgs32)\
**Post date:** [May 1, 2018, 10:41pm UTC](https://discuss.konghq.com/t/need-to-strip-path-but-also-want-original-uri/906/1 "2018-05-01T22:41:20Z")

</div>

I’m surely not the only one using Kong in front of a JSON API like on the homepage here: [http://jsonapi.org/](http://jsonapi.org/)

But I want to do something like router from `/api/v4/widgets`  
to `/v1.0/widgets`

Therefore I have to strip\_path.

But I need to provide a `links` property in my api response that SHOULD contain the `api/v4/...` url.

Any suggestions? Is that a clear example?

 ![JSON_API_%E2%80%94_A_specification_for_building_APIs_in_JSON](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/1X/c90d1660c6113342c93bf5cce125a61e0155cf4a.png)

---

<div class="post-metadata">

**Author:** ![thibaultcha](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/thibaultcha/32/340_2.png) [@thibaultcha](https://discuss.konghq.com/u/thibaultcha)\
**Post date:** [May 1, 2018, 11:23pm UTC](https://discuss.konghq.com/t/need-to-strip-path-but-also-want-original-uri/906/2 "2018-05-01T23:23:09Z")

</div>

Hi,

In this case, you need to send the `ngx.var.request_uri` within the upstream request somehow (e.g. within a header):

```auto
# request made by Kong
GET /v1.0/widgets HTTP/1.1
Host: jsonapi.org
X-Gateway-Path: /api/v4/widgets 

```

For this, you have two solutions:

1. 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](https://getkong.org/docs/latest/plugin-development/)).
2. If you have an Enterprise Edition subscription, you can use the [EE request transformer](https://getkong.org/plugins/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/](https://konghq.com/kong-enterprise-edition/)

Hope that helps,
