Localhost API not working

I am trying to configure my localhost API on Tyk which is based on PHP I don’t know why but it keeps returning the error: {“error”: “There was a problem proxying the request”}.
I have tried my webserver API’s and they are working fine not working when I am trying to access localhost API.
Any Help.

Hi @taby,

Thanks for writing in!

Are you able to access your API directly (without using Tyk)? If so, do you get the expected data or do you get an error? Reason I ask is I want to make sure it’s running in a web server and ready to be proxied to.

I’ll need a bit more information about how you’ve set your API definition on Tyk. Are you able to link it here?

Also one of my colleagues has an article on our website Getting Started With Tyk On Your Local Machine - Tyk API Gateway where he creates an API then uses Tyk for it. Now the article is a bit different in the sense that the local API is created using Node/Express while you’re using PHP HOWEVER the process should still be the same.

In short the process is:

  1. Create your API locally
  2. Hit your API endpoint. This can be done before introducing the Tyk stack. You can use a curl command, Postman, or just by simply hitting the endpoint on your browser.
  3. Start Tyk Stack
  4. Create the API definition on the Tyk stack. Here’s the link to our docs for creating the API definition Create an API.
  5. Hit API to make sure it’s working

Hope this helps,


In @Valmir linked article, this part was the revelation:

You’ll notice that we do not use localhost:3030 or to point to our Node API and instead use host.docker.internal. Since our Tyk setup is running within docker we need to explicitly say that we are using the host machine’s localhost and not the docker containers.

After I switched from localhost:3000 to host.docker.internal:3000 I was able to hit the upstream endpoints.

1 Like

Hi @crnastena,

Thank you for sharing your results as host.docker.internal:3000 can be a common failure point!


1 Like