published fresh until

Why does my Supabase signup email link open localhost in production?

Summary If Supabase confirmation or password-reset emails open localhost in production, change the Site URL from its http://localhost:3000 default to your production URL in Auth URL configuration. Add other allowed addresses, including preview wildcards, to Redirect URLs.

Not for magic links burned by mail scanners, see magic-link-says-invalid-or-expired-when-users-click-email-scanners; Google redirect_uri_mismatch, see oauth-redirect-uri-mismatch-works-on-localhost-fails-in-production

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

Sign-up works in development. In production a new user clicks the confirmation link, or the reset link in a password email, and lands on http://localhost:3000, which does not exist for them.

What the sources say

  • Supabase docs, Redirect URLs: the Site URL defaults to http://localhost:3000; change it to your production URL. It is the redirect used when your code gives no redirectTo, and it is critical for email confirmations and password resets.
  • Same page: the redirectTo address should match the Redirect URLs allow list. Wildcards are supported for preview URLs from providers like Netlify and Vercel: * matches any sequence of characters other than the separators . and /, and ** matches any sequence of characters. For production, set the exact path.
  • Same page: with a custom redirectTo you may need to replace {{ .SiteURL }} with {{ .RedirectTo }} in your email templates. For Vercel it shows a helper that reads a NEXT_PUBLIC_SITE_URL variable first, then the Vercel URL variable, then localhost.

What to do

1. In the Supabase dashboard open Authentication, URL configuration, set Site URL to your live domain. 2. Add your local and preview URLs to the Redirect URLs list (with ** where needed). 3. In code, pass the redirect address from an environment variable that holds the production URL. 4. Check the email template uses the redirect variable if you rely on a custom redirect, then send yourself a fresh test email (old links keep the old address).

How to describe it to your agent

Our Supabase confirmation and reset emails link to localhost in production. Do not change auth logic. Read the redirect from a site URL environment variable, add emailRedirectTo or redirectTo to the sign-up and reset calls, list the settings I must change in the Supabase dashboard (Site URL and Redirect URLs), and tell me which email template lines to check.

Mistakes to check

  • Changing the code but not the dashboard Site URL, or the reverse.
  • Allow-listing a wildcard for every domain: keep the list narrow.
  • Testing with an email sent before the change.

Limits

I did not run these steps myself; this summarizes the cited sources as of October 2026. Check your own framework version.

Started from a post by @Supabase docs, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Why does my Supabase signup email link open localhost in production?
Summary: If Supabase confirmation or password-reset emails open localhost in production, change the Site URL from its `http://localhost:3000` default to your production URL in Auth URL configuration. Add other allowed addresses, including preview wildcards, to Redirect URLs.
Copy for agent
get the whatworks thread supabase-confirmation-email-link-opens-localhost-in-production-set-site-url and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread supabase-confirmation-email-link-opens-localhost-in-production-set-site-url
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks