Skip to content

feat: add support for Dynamic App Base URL#53

Open
frederikprijck wants to merge 14 commits into
mainfrom
feat/dynamic-app-base-url
Open

feat: add support for Dynamic App Base URL#53
frederikprijck wants to merge 14 commits into
mainfrom
feat/dynamic-app-base-url

Conversation

@frederikprijck

@frederikprijck frederikprijck commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

Adds dynamic application base URL support to @auth0/auth0-nuxt, allowing a single Nuxt app to serve multiple origins from one Auth0 application.

appBaseUrl now supports three modes:

  • Static ("https://app.example.com") — unchanged current behavior.
  • Allow-list (["https://a.com", "https://b.com"], or comma-separated via NUXT_AUTH0_APP_BASE_URL) — the request origin is matched against the list. Recommended for production.
  • Dynamic (omitted) — the base URL is inferred per request from the host, honoring x-forwarded-host / x-forwarded-proto.

Changes

  • New runtime/server/utils/app-base-url.tsisUrl, inferBaseUrlFromRequest, resolveAppBaseUrl (uses h3's getRequestHost/getRequestProtocol).
  • New runtime/server/utils/config.tsparseAppBaseUrl, validateAppBaseUrl, enforceSecureCookies, resolveAuth0Options. Comma-separated parsing, validation, and production secure-cookie enforcement. Returns a new options object (the Nuxt runtime config is frozen).
  • Plugin auth.server.ts — resolves/validates options; the hard appBaseUrl required-check is removed (dynamic mode omits it).
  • use-auth0.ts — only bakes a static redirect_uri; in dynamic/allow-list mode the login handler supplies it per request.
  • Handlers — login/callback/logout resolve the base URL from their own event.
  • TypesappBaseUrl?: string | string[]; InvalidConfigurationError re-exported from the module entry.
  • Example — new examples/example-nuxt-web-dynamic-app-base-url (two-host allow-list demo).
  • Docs — README + EXAMPLES document the three modes and the production secure-cookie requirement.

Design spec and implementation plan are included under docs/superpowers/.

Test Plan

  • Unit tests pass (npm run test:unit — 76 passing, +32 new across resolver, config, and the three handlers)
  • Lint clean (npm run lint)
  • Build succeeds (npm run build), InvalidConfigurationError exported
  • E2E (npm run test:e2e) — runs in CI with Auth0 tenant secrets (live login flow); not runnable locally without credentials

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@frederikprijck, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 57 minutes and 45 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f63902fa-0177-4b8f-b6a5-9f7e2896fe92

📥 Commits

Reviewing files that changed from the base of the PR and between 7931c04 and 4b2f9c5.

⛔ Files ignored due to path filters (2)
  • examples/example-nuxt-web-dynamic-app-base-url/public/favicon.ico is excluded by !**/*.ico
  • examples/example-nuxt-web-dynamic-app-base-url/public/img/auth0.png is excluded by !**/*.png
📒 Files selected for processing (28)
  • examples/example-nuxt-web-dynamic-app-base-url/.env.example
  • examples/example-nuxt-web-dynamic-app-base-url/.gitignore
  • examples/example-nuxt-web-dynamic-app-base-url/README.md
  • examples/example-nuxt-web-dynamic-app-base-url/app.vue
  • examples/example-nuxt-web-dynamic-app-base-url/nuxt.config.ts
  • examples/example-nuxt-web-dynamic-app-base-url/package.json
  • examples/example-nuxt-web-dynamic-app-base-url/pages/index.vue
  • examples/example-nuxt-web-dynamic-app-base-url/pages/private.vue
  • examples/example-nuxt-web-dynamic-app-base-url/pages/public.vue
  • examples/example-nuxt-web-dynamic-app-base-url/public/robots.txt
  • examples/example-nuxt-web-dynamic-app-base-url/server/middleware/auth.server.ts
  • examples/example-nuxt-web-dynamic-app-base-url/tsconfig.json
  • packages/auth0-nuxt/EXAMPLES.md
  • packages/auth0-nuxt/README.md
  • packages/auth0-nuxt/src/module.ts
  • packages/auth0-nuxt/src/runtime/server/api/auth/callback.get.spec.ts
  • packages/auth0-nuxt/src/runtime/server/api/auth/callback.get.ts
  • packages/auth0-nuxt/src/runtime/server/api/auth/login.get.spec.ts
  • packages/auth0-nuxt/src/runtime/server/api/auth/login.get.ts
  • packages/auth0-nuxt/src/runtime/server/api/auth/logout.get.spec.ts
  • packages/auth0-nuxt/src/runtime/server/api/auth/logout.get.ts
  • packages/auth0-nuxt/src/runtime/server/composables/use-auth0.ts
  • packages/auth0-nuxt/src/runtime/server/plugins/auth.server.ts
  • packages/auth0-nuxt/src/runtime/server/utils/app-base-url.spec.ts
  • packages/auth0-nuxt/src/runtime/server/utils/app-base-url.ts
  • packages/auth0-nuxt/src/runtime/server/utils/config.spec.ts
  • packages/auth0-nuxt/src/runtime/server/utils/config.ts
  • packages/auth0-nuxt/src/types.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dynamic-app-base-url

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant