Skip to content

fix: respect app.baseURL in devtools iframe src#322

Merged
huang-julien merged 3 commits intonuxt:mainfrom
fabkho:fix/devtools-base-url
Apr 25, 2026
Merged

fix: respect app.baseURL in devtools iframe src#322
huang-julien merged 3 commits intonuxt:mainfrom
fabkho:fix/devtools-base-url

Conversation

@fabkho
Copy link
Copy Markdown
Contributor

@fabkho fabkho commented Apr 11, 2026

Summary

  • Fix DevTools custom tab iframe not loading when app.baseURL is set to a non-root value (e.g., behind a reverse proxy)
  • Use joinURL from ufo to prepend app.baseURL to the devtools iframe src

Fixes #321

Context

This is the same bug that was reported and fixed in @nuxt/a11y:

Changes

  • src/devtools.ts: Import joinURL from ufo and wrap DEVTOOLS_UI_ROUTE with joinURL(nuxt.options.app?.baseURL || '/', DEVTOOLS_UI_ROUTE) in the addCustomTab call
  • package.json: Add ufo as an explicit dependency

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3b2eb74f-cb8d-41d7-8fca-f718444ed037

📥 Commits

Reviewing files that changed from the base of the PR and between 7f48fc0 and 72b3366.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • src/devtools.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/devtools.ts

📝 Walkthrough

Walkthrough

This pull request adds a runtime dependency on the ufo package (version ^1.6.3) to package.json and updates the DevTools iframe src in src/devtools.ts to properly respect the app's baseURL configuration. The iframe src is now constructed by joining nuxt.options.app?.baseURL (or '/' as a fallback) with the DEVTOOLS_UI_ROUTE constant using the joinURL function from the newly added ufo package, fixing an issue where the iframe would fail to load when the app is served behind a reverse proxy with a custom base path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: respect app.baseURL in devtools iframe src' accurately summarizes the main change: fixing the DevTools iframe to respect the app's baseURL configuration.
Description check ✅ Passed The description clearly explains the bug, the fix, and provides context by referencing a similar fix in @nuxt/a11y, all of which align with the actual code changes.
Linked Issues check ✅ Passed The PR fully addresses issue #321 by implementing the exact fix specified: importing joinURL from ufo and wrapping the route with joinURL(nuxt.options.app?.baseURL || '/', DEVTOOLS_UI_ROUTE).
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue: adding the ufo dependency and modifying the devtools iframe src to respect baseURL, with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Line 51: package.json was updated to add the "ufo" dependency but the pnpm
lockfile wasn't regenerated, which breaks CI with frozen-lockfile; run pnpm
install (or pnpm install --lockfile-only) locally to regenerate pnpm-lock.yaml,
verify the lockfile includes the new "ufo" entry, and commit the updated
pnpm-lock.yaml alongside the package.json change so CI/release can proceed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 31d2084b-0637-4e99-8852-622fbe03eed8

📥 Commits

Reviewing files that changed from the base of the PR and between 86b47d2 and 7f48fc0.

📒 Files selected for processing (2)
  • package.json
  • src/devtools.ts

Comment thread package.json
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 11, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/hints@322

commit: 72b3366

@huang-julien huang-julien self-assigned this Apr 14, 2026
@huang-julien huang-julien merged commit 25f8fa8 into nuxt:main Apr 25, 2026
6 checks passed
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.

DevTools tab iframe does not respect app.baseURL

2 participants