# Change url with header value

**URL:** https://discuss.konghq.com/t/change-url-with-header-value/13017
**Category:** General
**Created:** [September 15, 2024, 11:56am UTC](https://discuss.konghq.com/t/change-url-with-header-value/13017 "2024-09-15T11:56:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![janjaap](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/janjaap/32/4656_2.png) [@janjaap](https://discuss.konghq.com/u/janjaap)
#### Post date: [September 15, 2024, 11:56am UTC](https://discuss.konghq.com/t/change-url-with-header-value/13017/1 "2024-09-15T11:56:10Z")

</div>

Hi!

I have a challange that I can’t get to work. I want a value that is send in the header added to the destination url. I try the REQUEST TRANSFORMER only it’s not working with the $(headers.header-name) or $(headers.[“header-name”]) actions. Any idea how to get this working or only possible by custom extension?

---

<div class="post-metadata">

### Author: ![rick](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/rick/32/4446_2.png) [@rick](https://discuss.konghq.com/u/rick)
#### Post date: [September 18, 2024, 7:34pm UTC](https://discuss.konghq.com/t/change-url-with-header-value/13017/2 "2024-09-18T19:34:40Z")

</div>

@janjaap Are you able to use _header based routing_ to solve your needs instead of rewriting urls? The `routes` entity supports a `headers` field which will match headers and which you can attach to a `service`.

> **[Gateway Admin - OSS - OpenAPI Specifications | Kong Docs](https://docs.konghq.com/gateway/api/admin-oss/latest/#/Routes/create-route)**
>
> Kong Gateway (OSS) comes with an internal RESTful API for administration purposes.

---

<div class="post-metadata">

### Author: ![janjaap](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/janjaap/32/4656_2.png) [@janjaap](https://discuss.konghq.com/u/janjaap)
#### Post date: [September 19, 2024, 7:27am UTC](https://discuss.konghq.com/t/change-url-with-header-value/13017/3 "2024-09-19T07:27:24Z")

</div>

@rick Hi Rick, thank you for replying, so the problem is not the rout the problem is de destination. The client send a message to kong with a path /test/ or something and some specific data in a header. The message needs to be send to a destination where they require a url like: /test/$HeaderValue so I need to some how change the route path or destination url.

---

<div class="post-metadata">

### Author: ![janjaap](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/janjaap/32/4656_2.png) [@janjaap](https://discuss.konghq.com/u/janjaap)
#### Post date: [September 26, 2024, 9:50pm UTC](https://discuss.konghq.com/t/change-url-with-header-value/13017/4 "2024-09-26T21:50:21Z")

</div>

@rick Found out that this is only possible to do on the route not on the service. So by changing the uri in the route the data from the service is ignored.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/8/8651049fb84484276f21c943c975876b17c63898.png) [@system](https://discuss.konghq.com/u/system)
#### Post date: [September 28, 2024, 9:51pm UTC](https://discuss.konghq.com/t/change-url-with-header-value/13017/5 "2024-09-28T21:51:08Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
