Proxy Mail QA

Why your verification link goes to localhost:3000, and how to fix it

You sign up on staging, the email arrives, you click the link and get "This site can't be reached" at localhost:3000. The email isn't broken: your app is putting a development address into it.

Updated

What’s happening

Every verification, magic-link, invite and reset email contains a link back to your app. Your auth provider or framework builds that link from a setting: the site URL, a redirect URL, or the host your mailer is configured with. When that setting still says http://localhost:3000, every email points at the developer’s own computer.

Sometimes the link itself is hosted, for example https://yourproject.supabase.co/auth/v1/verify?..., and only the page it redirects to afterwards is local. The verification succeeds, then the browser is sent to localhost:3000 and fails. That version is easy to miss, because the email looks fine.

Fix it in Supabase (including Lovable apps on your own Supabase project)

  1. In the Supabase dashboard, open Authentication → URL Configuration.
  2. Set Site URL to your live address, such as https://your-app.lovable.app or your own domain. A new Supabase project starts with http://localhost:3000 here.
  3. Add every other environment you use (staging, preview domains, localhost for development) to Redirect URLs. Wildcards are supported for preview deployments.
  4. If your code passes emailRedirectTo or redirectTo when calling sign-up or sign-in, build it from the current site, for example window.location.origin, or an environment variable. A redirect that isn’t on the allow list falls back to the Site URL.
  5. If you’ve customised the email templates, check they use the template’s confirmation URL or site URL variables rather than a hard-coded address.

Fix it in Firebase Authentication

  • Check the continue URL your code passes in its action code settings when sending verification or sign-in links. It should come from the environment, not a hard-coded http://localhost.
  • Add your live domain under Authentication → Settings → Authorized domains.

Fix it in other stacks

  • Auth.js / NextAuth: set the deployment URL (AUTH_URL, or NEXTAUTH_URL on older versions) where your host doesn’t infer it.
  • Ruby on Rails: set config.action_mailer.default_url_options with the right host in each environment’s config.
  • Django: build links from the request or the Sites framework, and make sure the site’s domain isn’t still example.com or localhost.
  • Laravel: set APP_URL for each environment.
  • Anything else: search the code for localhost:3000 and move it into an environment variable.

The same setting causes the same bug on hosted sites. The link works, but on a different site from the one the person signed up on:

  • A preview and the published app. A sign-up on preview--myapp.lovable.app or a Vercel preview whose link goes to the published app (or the other way) confirms the account on one and leaves the person signed out on the other. Add each preview address to the auth provider’s redirect URLs, and build the redirect from window.location.origin.
  • The platform’s own address. An app on its own domain whose links still go to myapp.base44.app or myapp.vercel.app: set the site URL to the domain.
  • Bubble’s version-test. Bubble keeps the development version at /version-test, with its own data. A confirm or reset link that leads to the live app sends someone testing version-test to a version where their test account doesn’t exist. Check the page the email’s link is built from in the workflow.
  • Plain http. A link to http:// on a site that uses https: browsers warn, and the token can be read on the way. Set the site URL with https://.

Proxy Mail QA compares each verify, sign-in, invite or reset link with the site the account was used on. The inbox and the Accounts row flag one that goes elsewhere, and waits return link_site for tests and coding agents.

On a phone simulator or emulator

The iOS simulator shares your computer’s network, so localhost links open there. The Android emulator doesn’t: it reaches your computer at 10.0.2.2, so a link to localhost:3000 opens nothing. For an emulator, point the app’s links at http://10.0.2.2:3000, or better, at a staging address both can reach. More in Mobile apps.

How Proxy Mail QA flags it

When a link in a test email points at a local address, or redirects to one after verifying, Proxy Mail QA marks it on the Accounts row (“Redirects to localhost:3000”) and explains it in the inbox. You can tell at a glance that the environment is misconfigured, before anyone files it as “verification is broken”.

If you’re testing a local build on purpose, choose This is my dev environment. Links to that host stop being flagged in that project, and the email checks pass them. You can remove it again from the project’s settings. A coding agent can mark the host itself with the MCP tool mark_dev_host, and a test suite with POST /v1/project/dev-hosts (markDevHost in the Node.js client, mark_dev_host in the Python helper).

Try it on your next sign-up test

Free plan, no credit card. Create an address and watch the code or link arrive.

Create a free accountOpen the app

Questions

Why does the link work for the developer but not for me?

localhost always means "this computer". On the developer's laptop their dev server is running, so the link opens. On anyone else's machine there is nothing listening, so it fails.

Is a localhost link ever correct?

Yes, when you're testing a local build on purpose and the dev server runs on the same computer you click from. In Proxy Mail QA, mark that host as a dev environment and links to it won't be flagged again in that project.

I fixed the setting. Why do old emails still link to localhost?

The address is written into each email when it's sent. Request a new email after changing the setting; the old ones will keep their old links.

Which links does Proxy Mail QA flag?

Links to localhost, 127.0.0.1, 0.0.0.0, private network addresses such as 192.168.x.x, and names ending in .local, .test or .localhost, plus hosted links that redirect to one of those after verifying, such as Supabase's redirect_to or Firebase's continueUrl.

Built your app with an AI tool? Pick yours