Nuxt DevTools causes 404 error on custom HTTPS domain
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- nuxt, typescript
- Lĩnh vực
- developer-experience, devtools
Hướng nghiên cứu
Tái hiện bằng thiết lập HTTPS cho custom-domain trong nuxt.config.ts, sau đó kiểm tra NuxtDevServer.toNodeHandle và client của DevTools xung quanh NUXT_DEVTOOLS_VIEW. So sánh hành vi với localhost và chạy thiết lập đã được báo cáo. Hoàn tất khi custom HTTPS domain tải được DevTools mà không có các lỗi 404 lặp lại trên /_nuxt/, lỗi cross-origin hoặc panel bị hỏng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 3.3k
- Fork
- 214
- Merge trung bình
- 19 giờ 45 phút
- Pull request đã merge (30 ngày)
- 12
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nuxt/devtools
-
fix: Inspect panel styles break when host page sets a custom html font-size (rem-based units) Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
feat: Nuxt devtools for AI Đang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
bug needs reproduction
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Tất cả issue của nuxt/devtools
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
bcgov/bc-wallet-mobile#4761 · 1 bình luận ·
-
external-issue to-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
area-deployment area-integrations triage:bot-seen
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 86/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100