Hi there!
I have tried countless times, but to no avail. I’m trying to get a simple rewrite working, but the docs section on url rewrite are a bit thin and more examples would be great.
First off, the regex syntax doesn’t seem quite right and I’m not sure if I’m doing it correctly. I’m an old Perl guy who’s done a TON of regexes, and something like this:
“match_pattern”: “(w+)/(w+)”,
Seems to me ought to be:
“match_pattern”: “(\w+)/(\w+)”
But maybe your regex engine is different.
Anyhow,this is what I have:
“listen_path”: “/rest/”,
“target_url”: "http://some-service:6055
my app has two simple URLs, both for POST and GET:
/rest/application
/rest/some-otherthing
Tyk runs on port 8080, using k8s.
(note the hyphen/dash)
The underlying service is
/v1/application
/v1/some-otherthing
All I want to do is if someone goes to (example)
/rest/application
Go to the internal URL (target_url + the following)
/v1/application
I have tried:
“url_rewrites”: [{
“path”: “/rest/application/{id}”,
“method”: “GET”,
“match_pattern”: “/rest/application/(\w+)”,
“rewrite_to”: “/v1/application/$1”
},…
or
“match_pattern”: “/rest/application/(w+)”,
How can I do this?
Furthermore, how can I have it log specifically the rewrite and attempts to use the URL specified in the rewrite?
Thanks!