After recent update, since yesterday, I was experiencing “Reconnecting” with any chat request from within my devcontainers and “Taking longer than expected” when messaging from Agents Window into a devcontainer.
Steps to Reproduce
Just any message in chat window in IDE or in Agents Window connected to a devcontainer.
I actually found a fix, hope this will help someone as I see a lot of people posting about connection issues last few days.
I’ve added a whole bunch of Cursor hostnames into a Docker firewall config (add allowed-domains).
Since I’m a new user and cannot post more than 2 links, I won’t share a domain list.
But you can grab it via “Cursor Settings” → “Browser & Network” → “Required Domains” → “Copy domains”.
Just make sure you add all of the subdomains for api5 host (they can be found here: Network Configuration | Cursor Docs)
This was not needed in the previous versions of Cursor though.
Cheers!
Hey, thanks for the report and for sharing the fix. You diagnosed it correctly.
In recent versions, the Agent connection to Cursor servers is opened from inside the dev container, not from the Cursor app on your Mac. Because of that, a container firewall that only allows specific hostnames now also needs to allow Cursor domains. The in-container chat and the Agents Window that talks to that container use the same path, which explains why you see both symptoms.
For anyone who hits the same issue, you can get the domains in Cursor Settings > Browser & Network > Required Domains > Copy domains. Most container firewalls don’t understand wildcards, so you need to expand *.api5.cursor.sh into the explicit hosts from Network Configuration | Cursor Docs, plus api2.cursor.sh, and make sure DNS requests to those hosts are allowed too.
As for why it didn’t used to be required, yep, the behavior changed in recent releases. I passed this to the team as feedback. We’re looking into letting the Agent connect through the local Cursor app when the container can’t reach our servers directly, so firewall changes won’t be needed. I can’t share an ETA yet, but we’ll post updates.
Thanks again for writing up the solution. It will really help other users.
The issue has been fixed for me with version 3.21.13+.
"Agent Stability: Patches within the 3.21.x cycle (specifically following the initial 3.21.4 rollout) address intermittent network hanging issues where the agent would get stuck indefinitely on “Taking longer than expected” prompts. "
Hey, thanks for following up. Glad it started working after the update.
Quick clarification so we don’t confuse anyone. The stabilization patches in the 3.21.x cycle mentioned in the release notes fix a general hang on “Taking longer than expected”. That’s slightly different from the specific case in this thread. Here, the issue was the container firewall only allowing certain hostnames. In newer versions, Agent opens the connection from inside the dev container, so you need to add the Cursor domains to your firewall allowlist. For this scenario, the solution from Post #5 is still the right one. Allowlist the domains and expand *.api5.cursor.sh into explicit hosts.
We’re still working on an improvement where Agent can route through the local Cursor app when the container can’t reach our servers directly. That would avoid firewall changes. I can’t share an ETA yet, but we’ll post updates in this thread.
If you’re on 3.21.13+ and you still see this happening specifically inside the dev container, please reply and we’ll take a closer look.
The improvement I mentioned above is now available. Starting in Cursor 3.21.13, if Agent can’t reach our servers from inside a dev container, it will automatically route that connection through the Cursor app on your Mac. That means the container firewall no longer needs to keep Cursor domains on an allowlist for chat and the Agents Window to work.
Your current allowlist setup will keep working as-is, so you don’t need to change anything. If you want to remove those firewall entries, just make sure you’re on a recent version, stable is currently 3.21.18. If you want to skip the automatic check entirely, you can set cursorAgentHost.remoteInferenceRoute to always in settings. It applies after you reload the window.
Let me know if you’re still seeing “Reconnecting” inside the dev container on the latest version and we’ll dig in.