I am trying to create a demo and additionally I am using tyk in the docker-compose version for that purpose. For the demo I am using the dashboard because in de future our company is planning to use the dashboard for statistics. My problem is when I try to create a Endpoint Designer route the dash board does no save the route like the next example and the complete context for my problem. I don’t know if I did something else wrong please let me know. API URL:http://www.tyk-portal-test.com/test-api/
Mocks need to be also part of a list (e.g. white list), otherwise they don’t work. When Tyk is parsing the routes, it is probably losing that data because they are not part of a list object. This only affects mocks
Hi Martin
Thanks for the quick response. You are right, it is working fine and now is saving. However when I am doing the api call to the http://localhost:3000/test-api/ using post, it said that the API rout that I just created in TYK is not working, why? if the route said that is active.
Can you share your tyk gateway log? It’ll be in there. It could be that the API hasn’t loaded yet, there’s a 10s delay for reloads so that we can batch them.
Thank you for the response. I used the documentation before but it didn’t work because as soon I add the endpoint and I try to get the information with curl -H “Authorization: null” http://localhost/test-api/get it says that :
{
“error”: “Requested endpoint is forbidden”
}
However, ever I believe that is because of the way that I am creating the curl call. To this point I believe that my call should be different to generate the request with body and everything but I don’t know, I haven’t read all the documentation.
I just tried an stiil doesn’t works: [email protected]:~/GIT/tyk/tyk_quickstart$ curl -H “Authorization: 56aa831c27712f00010000010267d921a3a44bd847ecd96613f2a36” http://localhost/test-api/get
{
“error”: “Requested endpoint is forbidden”
}
Which, in proxy terms, would be: http://localhost/test-api/http://0.0.0.0:5000/, which is totally invalid. And since it’s a white-list, only that pattern will pass, so your request to /get is not on the white list, so it will fail.
The path you put in the designer is for routes that are on your target. So for example, httpbin.org has:
/get
/post
/put
etc…
So to white list those endpoints simply add get, post, and put as paths (with the methods GET, POST and PUT) and then those will be allowed through, but all others will fail.
This is a test with 0.0.0.0:
time=“2016-01-29T00:41:07Z” level=error msg=“http: proxy error: dial tcp 0.0.0.0:5000: getsockopt: connection refused”
This is a test with 127.0.0.1:
time=“2016-01-29T00:40:25Z” level=error msg=“http: proxy error: dial tcp 127.0.0.1:5000: getsockopt: connection refused”
This is a test with localhost:
time=“2016-01-29T00:37:53Z” level=error msg=“http: proxy error: dial tcp [::1]:5000: getsockopt: connection refused”
This is a test from postman to show you that the APIs are up in http://0.0.0.0:5000:
That might be fine on your host OS, but inside the docker container it doesn’t know what 0.0.0.0 is, so you need to target your application directly using a network address the container can see
I don’t believe the networking is the issue. I tried to prove your point but now I am having an issue with the token because:
{
“error”: “Key has expired, please renew”
}
and I create a new key like I am showing here:
and the response is this one: [email protected]:~/GIT/tyk/tyk_quickstart$ curl -H “Authorization: 56aa831c27712f00010000015abc8332108942f4608c7db4ba7babe4” http://192.168.161.113/test-api/get
{
“error”: “Key not authorised”
}
That response means the key isn’t allowed to access the API you created.
It is unrelated to the network error you had earlier.
To test the proxying issue. Open a bash shell inside the docker container and try to call your API directly.
To test the authentication error (this one) then you should set your API to open so it doesn’t need a key, then when you make the request, you’ll see if your API is reachable by the proxy.
Hi Martin
Thanks for your response. The networking is no an issue because I changes the tyk to point to 192.168.161.113 and the proxy error still there. Additionally, the the token is still not authorized even I create new tokens.