Why Cursor AI cannot reach localhost and how to fix it with a public tunnel
Cursor routes all chat and agent requests through its remote cloud servers at api2.cursor.sh, meaning any OpenAI Base URL set to localhost is resolved against the remote server's loopback interface, not the user's machine. This causes requests to Ollama, LiteLLM, LM Studio, or custom proxies running on local ports to silently fail, with Cursor showing connection errors while local logs remain completely empty. The root cause differs from tools like Aider or Continue.dev, which send LLM API calls directly from the user's local process. The fix requires exposing the local port over a public URL, which can be done using a Cloudflare tunnel that maps a public HTTPS address to the local service. Replacing the localhost URL in Cursor's model settings with the public tunnel address immediately allows the remote backend to reach the local proxy.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in