Can you share your Tyk log from when the gateway starts or hot reloads? It should list out the heirarchy of what it is listening for.
If you have two APIs, then read/all will be matched before read/
I would suggest that to debug, get rid of the rewrite, and instead point your app at httpbin (which echoes back the request metadata that it receives), and then use the header injector instead of the rewriter to make sure that the capture pattern is working.
Once you're certain it;s not the initial path match failing, then transpose that same config to the rewriter. Since you are not really using the rewriter to transpose data from the URL into the new one, you could just use wide regexes like (.*)
for the match pattern, because they are for extracting and moving data, they shouldn;t affect the match itself ass that's already happened.
Another thing you could do is have a single API definition that listens on /read/`, Then have it rewrite like this:
"url_rewrites": [
{
"path": /all",
"method": "GET",
"match_pattern": "all",
"rewrite_to": "measurement"
},
{
"path": "{a}",
"method": "GET",
"match_pattern": "(.*)",
"rewrite_to": "measurement/"
}
]
We're using a wildcard {a}
for the second version to catch the root (read
), and then the other match is explicit for /all
. That might work too...