Cannot access an API hosted on Vercel from a HuggingFace Space

Hey :waving_hand:

I have created a simple gradio app: RealFaviconGenerator MCP Server - a Hugging Face Space by MCP-1st-Birthday

This app is supposed to connect to RealFaviconGenerator API (hosted on Vercel) to analyze a favicon.

When I start this app locally with uv run app.py, I can issue an analysis from the “Favicon analysis” tab. However, in the app running on HuggingFace (see link above), it doesn’t work. Instead, I get a timeout.

I created two '“debug tools”, Ping website and Check domain, to investigate. Here are my findings:

  • On my machine, everything works: I can access RealFaviconGenerator API, access any website such as Amazon’s and resolve any domain such as Google’s.

  • On HuggingFace, everything works but HTTP access to RealFaviconGenerator: whenever I try to use RealFaviconGenerator API or access a page of RealFaviconGenerator, I get a timeout. The rest works: realfavicongenerator.net can be resolved as a domain, and I can access the homepages of Amazon, etc.

At this point, I know the issue is when HuggingFace and Vercel are involved. I’m able to reproduce the issue with another website hosted on Vercel, which reinforce this hypothesis.

The issue might be due to the WAF of Vercel. What I tried:

  • Add a rule to Vercel WAF to prevent check on routes starting with /api/v2/

  • Disable WAF entirely

To no avail: I still get the same timeouts.

I wanted to whitelist IPs from HuggingFace, but I couldn’t find them.

Although I’m confident the issue is due to the HF-Vercel interaction, I don’t know what’s wrong and I couldn’t find anything relevant online.

Any though?

PS: I posted the same issue on HF forum at Cannot reach an API hosted on Vercel from a HuggingFace Space - Spaces - Hugging Face Forums