URL rewrite timing out if the target container is in a different node

Hi,

I am using tyk docker container to proxy [URL rewrite] requests to my services. I have deployed this in a docker swarm which has two nodes. URL rewrite is not working if the target container is not on the same node as tyk container. It is working fine if tyk and my API service are running on same docker swarm node. I tried CURL from tyk container to my API [running on different node] and it is working fine.

The request is timing out after 2 mins with below error.

level=error msg=“http: proxy error: EOF” api_id=xxxx org_id=yyyy server_name=“xxxx:333” user_id=-- user_ip=10.255.0.5 user_name=

Any help would be greatly appreciated.

Regards
r

Well, it is a networking issue.
Ensure that both of your containers are inside the same swarm network.
Also how you specify the address of the upstream: using ingress load balancer url?

Hi leon,

Thanks for the reply.
yes, it could be network issue, but when curl the URL from tyk container it is responding OK. Problem is only when it is accessed through tyk application [URL Rewrite]. Both containers are in the same network overlay. Also it is working when both containers are running on same docker swarm node.

Do you still see it as a network issue?

Regards,
r

Can you clarify what you mean by URL rewrite, the actual endpoint designer plugin, or just simple proxying?

But anyway it still feels like networking issue. For inside docker network and for outside docker network, it can use different addresses.

We have something like this…

“url_rewrites”: [{
“path”: “/yyy(.)",
“method”: “GET”,
“match_pattern”: "/yyy(.
)”,
“rewrite_to”: “http://xxxx:5000/api/yyy$1
},

Yes, even I think it is network issue, but I am not 100% convinced because when I ping/curl from tyk container the target container it is working.

logged into the tyk container using the command “docker exec -it tyk-container bash”.

To close thread - I am able to resolve this.
This is due to MTU setting, was able to resolve the issue after changing the value.

Thank you Leon for the help.