# Changing upstream url

**URL:** <https://discuss.konghq.com/t/changing-upstream-url/261>\
**Category:** Questions\
**Created:** [December 19, 2017, 3:28pm UTC](https://discuss.konghq.com/t/changing-upstream-url/261 "2017-12-19T15:28:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [December 19, 2017, 7:19pm UTC](https://discuss.konghq.com/t/changing-upstream-url/261/2 "2017-12-19T19:19:28Z")

</div>

Hi,

As of 0.11.0, and as documented in the [Changelog](https://github.com/Kong/kong/blob/master/CHANGELOG.md#0110---20170816) and [Upgrade path](https://github.com/Kong/kong/blob/master/UPGRADE.md#upgrade-to-011x) of that version, the way to update the upstream URL is via the `$upstream_uri` NGINX variable, accessible in the Lua-land as `ngx.var.upstream_uri`.

> The upstream URI is now determined via the Nginx $upstream\_uri variable. Custom plugins using the ngx.req.set\_uri() API will not be taken into consideration anymore. One must now set the ngx.var.upstream\_uri variable from the Lua land. [#2519](https://github.com/Kong/kong/pull/2519)

Additionally, you can access the `ngx.ctx.router_matches` variable defined [here](https://github.com/Kong/kong/blob/0.11.2/kong/core/handler.lua#L318), which contains values the Router detected for a given API (like the `Host` it matched with, or the `uri` or even PCRE capturing groups if the `uri` was a regex, etc… See [this declaration](https://github.com/Kong/kong/blob/0.11.2/kong/core/router.lua#L796-L801):

```lua
  matches = {
    uri_captures = matches.uri_captures,
    uri = matches.uri,
    host = matches.host,
    method = matches.method,
  }
}

```

If this isn’t documented, it is because it should not be considered stable or part of the public Lua API in any way yet, and is subject to changes. We will later provide a stable, documented public Lua API for plugins developers, stay tuned.

---

_[View the full topic](https://discuss.konghq.com/t/changing-upstream-url/261)._
