Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)75k · #2938

mime-type

Skill này làm gì

Skill này kiểm tra các header kiểu nội dung mà máy chủ gửi kèm HTML, CSS, JavaScript, ảnh và font. Skill dành cho người quản lý máy chủ web hoặc chẩn đoán tài nguyên trang bị lỗi.

Khi nào nên dùng

  • ✓Khi bạn nhờ agent kiểm tra máy chủ có gửi đúng loại tệp không.
  • ✓Khi một stylesheet hoặc script không tải và bạn nghi ngờ kiểu nội dung sai.
  • ✓Khi bạn thiết lập hosting hoặc framework mới và muốn xác nhận header đúng.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/mime-type/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/mime-type/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“CSS của tôi không tải trên website. Bạn có thể kiểm tra xem máy chủ có gửi đúng kiểu nội dung không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent kiểm tra header phản hồi của các trang chính và các tệp được liên kết. Nó so sánh từng loại với kiểu mong đợi, như text/css cho stylesheet, và gợi ý thay đổi máy chủ khi không khớp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

MIME Type Validation

Incorrect MIME types cause browsers to block stylesheets and scripts (MIME sniffing is disabled by X-Content-Type-Options: nosniff), breaking page rendering and signalling poor site quality to crawlers.

Quick Reference

  • The Content-Type header must match the actual file type being served
  • HTML pages must be served as text/html; charset=utf-8
  • CSS files must be served as text/css and JavaScript as text/javascript
  • Incorrect MIME types cause browsers to block or mishandle resources

Check

For key pages and their linked resources, inspect the HTTP Content-Type response header. Verify HTML responses use text/html; charset=utf-8, CSS uses text/css, JS uses text/javascript, and images use image/jpeg, image/png, etc.

Fix

Update your server configuration to serve each file type with its correct MIME type. Set X-Content-Type-Options: nosniff to prevent browsers from guessing content types. In Next.js and similar frameworks, configure headers in next.config.js.

Explain

The Content-Type header tells browsers and crawlers what kind of content is being sent. When it mismatches the actual file type, browsers either block the resource or render it incorrectly—CSS served as text/plain won't be applied, and JavaScript served as text/html may be blocked by strict MIME checking.

Code Review

For HTML, CSS, and JS assets, check the Content-Type response header. Verify HTML responses include 'charset=utf-8'. Check that X-Content-Type-Options: nosniff is set. Flag any resource returning Content-Type: text/html that is not an HTML page. Check for missing charset declarations on text responses.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/seo/mime-type

Câu hỏi thường gặp

Điều gì xảy ra khi kiểu nội dung sai?

Trình duyệt có thể chặn tệp hoặc hiển thị sai, nên một stylesheet có thể không áp dụng chút nào.

nosniff làm gì?

Header X-Content-Type-Options báo cho trình duyệt không được đoán kiểu, nên họ dựa vào giá trị máy chủ gửi.

Điều này được thiết lập trong Next.js như thế nào?

Skill gợi ý cấu hình header trong tệp next.config.js.

Chi tiết

Mô tả gốc của tác giả

Use when auditing server configuration or diagnosing broken resources. Applies to any web server serving HTML, CSS, JS, images, fonts, or other static assets.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2938
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự