DIAGNOSIS

After login, my app sends users to localhost

One setting your project was born with is quietly redirecting every sign-in to an address only your laptop can reach.

7 min read
ON THIS PAGE
SHORT ANSWER

Why does my app redirect to localhost after login?

Because Supabase sends people to the address in its Site URL field after sign-in, and new projects ship with that set to http://localhost:3000. That address only exists on a developer's own computer. Change it in your Supabase dashboard under Authentication, URL Configuration, to the address real people type.

Someone signs in. The page thinks for a second. Then the browser lands on localhost:3000 and says it can't connect, or just sits there white.

Nothing is broken in your app. Nothing is broken in your database. One setting, in one screen, is still holding the value it had the day your project was created — and every login is obediently following it.

Which setting decides where people land after login?

Supabase handles the sign-in. When it's done, it has to send the person's browser somewhere, so it needs an address. That address comes from a field called Site URL, in your Supabase dashboard under Authentication → URL Configuration.

Supabase's own documentation describes it as the default address people get sent to when your code doesn't name one, and tells you in plain terms to change it from http://localhost:3000 to your real address.1

They have to say that because every new project starts with that value. It's the address a computer uses to talk to itself while someone builds. On your laptop it works. In the world, it's a door that opens onto nothing.

If you built with Lovable, Bolt, Replit or v0, you almost certainly never saw that field. The tool created the project, the field got its default, and nothing in the build flow asked you to touch it. This is a default that outlived the moment it made sense in.

Why did changing Site URL not fix it?

Because there is a second cause that looks identical from outside. Your app can ask Supabase to send someone to a specific address after login — code written by an AI tool often does exactly that — but Supabase won't use an address it hasn't been told to trust.

That trusted list sits in the same screen, called Redirect URLs. If the address your app asks for isn't on it, Supabase refuses and falls back to Site URL. Which, if nobody changed it, is localhost again.1

  • Site URL is still the factory default, or
  • your app is asking for a real address that isn't on the trusted list, and Supabase is quietly falling back to the default.

That's why people fix one, test, and watch it still fail. They fixed half of it.

Is this a new bug or has it always done this?

It has always done this, and that's the good news. A Supabase community discussion opened in March 2022 describes the exact behaviour — magic link login landing on localhost:3000, with Site URL as the place you change it.2

It shows up constantly in the AI-builder world specifically. A write-up by Ishwar Rimal walks through a Lovable and Supabase project where Google sign-in worked locally but bounced to localhost once shared, with Site URL as the culprit.3 A case study documenting that same write-up calls the pattern a repeat visitor in Lovable community threads.4 Guides for Lovable builders list the untouched default as a frequent cause.5

How do I fix the localhost redirect?

  1. Open the right screen
    In your Supabase dashboard, pick the project your app uses, then go to Authentication → URL Configuration.
  2. Set Site URL to your real address
    The full thing, including https://, with no trailing slash. If you have a custom domain, use that — not the preview address your builder gave you, because preview addresses change and then you're back here.
  3. Add every other address to the trusted list
    Your custom domain, the version with and without www if both work, your builder's preview address if you still test there, and http://localhost:3000 if anyone runs the app locally. Keeping localhost on the list is fine; it's only harmful as the default.
  4. If you use Google or GitHub sign-in, check the third list
    In the Google Cloud console, the address you authorise is the Supabase callback shown on Supabase's own Providers screen — not your app's address. Google hands the person back to Supabase, then Supabase hands them to you. Guides for Lovable builders flag this specifically, because putting your own domain there feels right and doesn't work.5
  5. Test as a stranger
    Not on the tab you're already logged into. Log out, open a private window, sign up fresh, and click the email link. Test the signup and password reset emails too — those links are built from the same setting.

Why did nothing warn me this was broken?

Because your app never went down. The homepage loaded. The database answered. The only broken thing was the one path you personally stopped walking the day you launched: signing up as a new person.

That's the shape of most breaks in apps built this way. Not an outage. A door that quietly stopped opening, for people who never tell you.

I'll be straight about the limits here. Fomio, which I work on, watches an app from outside — you paste a link, it checks every minute and says Working, Having trouble or Down. A watcher looking from outside sees a healthy homepage while your login sends people to localhost. For this particular break, the steps above are the whole answer and you don't need us.

Where it earns its place is the day after. Redeploys, settings changed in a hurry, a domain switch — the session where you fix one thing is the session where something else moves. The free plan watches one app, checks every five minutes, emails you when it breaks and keeps a week of history, with no card. The Builder plan watches three, checks every minute, keeps thirty days, and writes a prompt you can paste straight into the tool you built with. Current prices are at fomio.ai/pricing.

PASTE THIS INTO YOUR AI TOOL
My app uses Supabase for sign-in. I've set the Site URL and the trusted redirect list in the Supabase dashboard to my live domain. Find anywhere in my code that passes a redirect address after login, signup or password reset, and make sure it uses my live domain rather than a hardcoded localhost address. List every file you changed.

What should I do right now?

  1. Supabase dashboard → Authentication → URL Configuration. Change Site URL from localhost:3000 to your real address.
  2. Add your real addresses to the trusted redirect list below it.
  3. If you use Google or GitHub sign-in, confirm the address authorised in Google's console is the Supabase callback, not your own domain.
  4. Log out, open a private window, sign up as a new person, and click the email link.

Four steps, no code, and the setting that caused it has been sitting there untouched since the day the project was made. It was never your fault. It just needed somebody to look at it.

Questions people also ask

WHERE THIS COMES FROM

  1. Redirect URLs — Supabase Docs
  2. Auth redirect and Additional Redirect URLs · Discussion #6088 — Supabase (GitHub Discussions), 26 March 2022
  3. Fixing the "logIn with Google" issue in lovable with Supabase integration — Ishwar Rimal, Medium
  4. Documented: Lovable Google Login Redirects to localhost:3000 — michaelbir.es case studies
  5. Adding OAuth Providers (Google, GitHub) in Lovable Auth Flow — Rapid Developers
  6. Lovable login works in preview, breaks in production: the 3 redirect lists — DEV Community
KEEP READING
Read this as markdown