Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:18:07 +0000.
Sender:Gavin Williams
.
Date:Friday, 10 July 2015 17:14:07 UTC+1.
Afternoon all
I’m currently evaluating Tyk for use as an API gateway on a new Microservice platform that we are building.
The microservices are all being built using Dropwizard, which seems by default to have the ‘version’ as the first part of the server-side path, e.g.: http://dropwizard-node:8080/v1/api
I’m currently trying to work out how to map this logic into Tyk.
I’ve defined the API, which has generated an ID of ‘714007cd6f1347906a9218a0a7ad2213’, setup the target URL of the API to ‘http://dropwizard-node:8080’, and also enabled the ‘URL or Form’ version manager.
However if I submit a request via tyk, I get the following error:
curl -i http://tyk.local:8080/714007cd6f1347906a9218a0a7ad2213/v1/api
HTTP/1.1 403 Forbidden
Content-Type: application/json
X-Generator: tyk.io
Date: Fri, 10 Jul 2015 16:07:29 GMT
Content-Length: 48
{
“error”: “Version information not found”
}%
If I specify a URL encoded ‘version=v1’ value, it works:
curl -i http://tyk.local:8080/714007cd6f1347906a9218a0a7ad2213/v1/api\?version\=v1
HTTP/1.1 200 OK
Content-Type: application/json
Date: Fri, 10 Jul 2015 16:08:59 GMT
Vary: Accept-Encoding
X-Ratelimit-Limit: 0
X-Ratelimit-Remaining: 0
X-Ratelimit-Reset: 0
Content-Length: 83
{“meta”:{“totalCount”:0,“offset”:0,“limit”:100},“catalogues”:[],“notifications”:[]}
However I’m now left with two ‘v1’ annotations, which doesn’t look great. So is there a way that tyk can pull the ‘/v1’ from the URL, and match that to the defined version?
Or alternatively, is there a way that tyk can insert the version into the target URL?
As if I try to remove the ‘/v1’ from the request, I get a 404 from the backend, as it’s just request ‘http://dropwizard-node:8080/api’…
curl -i http://tyk.local:8080/714007cd6f1347906a9218a0a7ad2213/catalogues\?version\=v1
HTTP/1.1 404 Not Found
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 299
Content-Type: text/html; charset=ISO-8859-1
Date: Fri, 10 Jul 2015 16:13:13 GMT
X-Ratelimit-Limit: 0
X-Ratelimit-Remaining: 0
X-Ratelimit-Reset: 0
Let me know if I haven’t been clear on anything above, or if I’ve fundamentally missed anything…
Regards
Gavin