Nuxt · Routing

NUXT0101Pass external: true to navigateTo for external URLs

Finds `navigateTo()` calls whose target is a string literal with a protocol, such as `https://` or `mailto:`, or a protocol-relative `//` URL, and no `{ external: true }`. Template literals and `+` concatenations count when their leading literal text already makes the URL external. Calls with `open`, spread options, or a computed `external` value are not reported, nor are `navigateTo` bindings that do not come from Nuxt.

Why it happens

navigateTo treats a target as external when ufo's hasProtocol(toPath, { acceptRelative: true }) matches it, and throws instead of navigating unless the options set external: true. The call fails at runtime with NUXT_E2001, "Navigating to external URL is not allowed by default", on the server and in the browser.

Fix

Pass { external: true } as the second argument. To open the URL in a new tab, pass { open: { target: '_blank' } } instead.

Example

Allow the external navigation

Before

await navigateTo('https://example.com/login')

After

await navigateTo('https://example.com/login', { external: true })

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm nuxt doctor --rules nuxt/routing/navigate-to-external
Copyright © 2026