HTTP 502 Bad Gateway. X-Upstream-Error: connection. X-Upstream-Detail: Не удалось подключиться к YummyAnime API: Connection timed out after 4001 milliseconds.
Other Information
Hello. My PHP script makes an HTTPS cURL request to api.yani.tv on port 443, but it returns HTTP 502.
The diagnostic error is: “Connection timed out after 4001 milliseconds.”
The same API request works from my local OSPanel environment. Could you check whether outbound connections from my hosting server to api.yani.tv:443 are reachable, and whether there might be a routing, DNS, or IPv6 issue?
Welcome to the InfinityFree community forum! Good to have you here.
Most people answering here are volunteers. They’re often the fastest source of help. Admin (the only staff member) checks in about once a day for issues on our end.
Volunteers can’t see your account or website. Share what you actually see, like error messages and what happens when you try something. That’s more useful than your theory of what’s wrong.
AI tools often get InfinityFree wrong. If a volunteer’s advice differs from what an AI told you, please try the volunteer’s suggestion first.
Solving an issue is a joint effort. Try the suggestions you get and report back what happened.
Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look.
Port 443 isn’t the problem. Our knowledge base says outbound connections are allowed on ports 80, 443 and 587, and blocked ports time out instead of being refused. Your request goes to 443, so the port isn’t what’s blocking it. The article also lists the services we block entirely, and api.yani.tv isn’t on that list.
The article is here:
The “after 4001 milliseconds” in your error looks like a 4-second connect timeout set in your own code, probably CURLOPT_CONNECTTIMEOUT or CURLOPT_TIMEOUT. The 502 and the X-Upstream-* headers look like they come from your script, not from our platform. So the request is probably just taking longer than 4 seconds to connect from here.
Can you raise the connect timeout to something like 15–20 seconds and tell me whether the request then succeeds? Please also post the raw curl_errno() and curl_error() output, not your script’s wrapped message. That would show whether it’s a plain timeout or a DNS or connection error.
To check whether the problem is specific to that API, you could also run a small PHP file containing <?php echo file_get_contents('https://ifconfig.me');. If that works, outbound HTTPS from your site is fine.
I did a quick test on one of my own accounts and I was able to connect from PHP to api.yani.tv from there. So there is no network block, or routing, DNS, or IPv6 issue.
A timeout of 4 seconds is pretty short, an an API endpoint that’s a bit on the slow side can take longer than that to respond. Could you try bumping it to something like 30 seconds and see if you still get the timeout?
And if you can, check locally what the API response time is there? If that’s already in the 2-3 second range, then a 4 second timeout doesn’t give you much headroom.