Skip to content

fix(server): auto-add localhost trusted origin in dev#128

Merged
onmax merged 4 commits intomainfrom
fix/dev-trusted-origins-minimal
Feb 13, 2026
Merged

fix(server): auto-add localhost trusted origin in dev#128
onmax merged 4 commits intomainfrom
fix/dev-trusted-origins-minimal

Conversation

@onmax
Copy link
Collaborator

@onmax onmax commented Feb 13, 2026

Summary

  • add dev-only localhost trusted-origin augmentation when runtimeConfig.public.siteUrl is explicitly set
  • detect localhost origin from Nitro dev origin (protocol + port), fallback to http://localhost:3000
  • preserve trustedOrigins semantics for arrays and functions (append + dedupe, filter nullable values)
  • add focused unit + e2e regression coverage for issue fix: auto-add localhost to trustedOrigins in dev mode #126

Tests

  • pnpm vitest run test/get-base-url.test.ts
  • pnpm vitest run test/dev-trusted-origins.test.ts
  • pnpm vitest run test/server-auth-base-url-cache.test.ts
  • pnpm eslint src/runtime/server/utils/auth.ts test/get-base-url.test.ts test/dev-trusted-origins.test.ts

Closes #126

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 13, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-modules/better-auth/@onmax/nuxt-better-auth@128

commit: 7fa52a3

@onmax onmax merged commit af5779b into main Feb 13, 2026
3 checks passed
@onmax onmax deleted the fix/dev-trusted-origins-minimal branch February 13, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: auto-add localhost to trustedOrigins in dev mode

1 participant