Nuxt DevTools causes 404 error on custom HTTPS domain
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- nuxt, typescript
调研方向
使用 nuxt.config.ts 中的 HTTPS 自定义域名设置进行复现,然后检查 NUXT_DEVTOOLS_VIEW 周围的 NuxtDevServer.toNodeHandle 和 DevTools 客户端。将其行为与 localhost 进行比较,并运行报告中的设置。完成标准是:自定义 HTTPS 域名能够加载 DevTools,且不会反复出现 /_nuxt/ 404、跨源错误或损坏的面板。
由索引模型根据 Issue 内容生成。
描述
Environment
- Nuxt: 4.2.2
- Node: v22.x
- OS: macOS
- Custom domain:
https://custom.domain.local:3000(local HTTPS with self-signed certificate)
Reproduction
Setup
npx nuxi init devtools-https-bug
cd devtools-https-bug
npm install
Generate local certificates
# Using mkcert (recommended)
mkcert -install
mkcert custom.domain.local
Configure nuxt.config.ts
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: true },
devServer: {
https: {
key: './custom.domain.local-key.pem',
cert: './custom.domain.local.pem',
},
},
})
Add hosts entry
# Add to /etc/hosts (macOS/Linux) or C:\Windows\System32\drivers\etc\hosts (Windows)
127.0.0.1 custom.domain.local
Development Server
Start the development server:
npm run dev
Open https://custom.domain.local:3000 in the browser.
Describe the bug
When running the Nuxt dev server on a custom HTTPS domain (not localhost), DevTools causes repeated 404 errors in the terminal and a cross-origin error in the browser console.
Terminal error:
ERROR [request error] [unhandled] [GET] https://custom.domain.local:3000/_nuxt/
ℹ Error:
⁃ at createError (node_modules/@nuxt/cli/dist/dev-KB30iboK.mjs:54:14)
⁃ at NuxtDevServer.toNodeHandle (node_modules/@nuxt/cli/dist/dev-KB30iboK.mjs:264:18)
[CAUSE]
{
status: 404,
}
Browser console error:
SecurityError: Failed to read a named property '__NUXT_DEVTOOLS_VIEW__' from 'Window': Blocked a frame with origin "https://custom.domain.local:3000" from accessing a cross-origin frame.
at client.js?v=81bfbde2:136:13
Additional context
Expected behavior
DevTools should work without errors on custom HTTPS domains.
Actual behavior
- Terminal shows repeated
/_nuxt/404 errors fromNuxtDevServer.toNodeHandle - Browser console shows cross-origin
SecurityErrorfor__NUXT_DEVTOOLS_VIEW__ - DevTools panel fails to load properly
Workaround
Disabling DevTools eliminates the errors:
devtools: { enabled: false },
Additional context
- Works fine on
https://localhost:3000 - The issue appears to be DevTools probing
/_nuxt/(bare path with trailing slash) which returns 404 - May be related to the fix in nuxt/nuxt#31646, but that fix doesn't seem to cover this case
Logs
- 主要语言
- TypeScript
- 星标
- 3.3k
- 派生
- 214
- 平均合并
- 19 小时 45 分钟
- 30 天内合并 PR
- 12
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nuxt/devtools 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
-
bug
难度 3/5 1-2 天 新手友好度 68/100
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
-
bug needs reproduction
难度 4/5 3-5 天 新手友好度 38/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
mksglu/context-mode#1200 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/claude-code#96687 ·
-
good first issue
难度 1/5 1 小时以内 新手友好度 95/100
AOSSIE-Org/DebateAI#582 · 2 条评论 ·