I think the issue here is that the first rewrite will not redirect to another API definition, it will send your rewritten URL to your target.
Also, the regex is a little wrong, we need to update it in the docs, this works:
v1\/centres\/(\w+)\/movies
You can see it in action here.
I rewrote it against httpbin as a path querystring argument (get?path=/movies/v1/centres/$1/movies
), so I could see the output of the rewrite, as you can see the rewrite worked as expected:
{
"args": {
"path": "/movies/v1/centres/test/movies"
},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip",
"Accept-Language": "en-GB,en;q=0.8,en-US;q=0.6,de;q=0.4,es;q=0.2",
"Cache-Control": "no-cache",
"Cf-Visitor": "{\"scheme\":\"https\"}",
"Host": "httpbin.org",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
"X-Scheme": "http"
},
"url": "http://httpbin.org/get?path=%2Fmovies%2Fv1%2Fcentres%2Ftest%2Fmovies"
}
If I wanted to target a different upstream host (or even a new API definition) I need to add a hostname component to the URL so it’s fully qualified like so:
https://httbin2.org/get?path=/movies/v1/centres/$1/movies
Tyk will detect that the hostname is different and use the new target hostname instead of the one configured in the API definition.