MIME Type .xlsx: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Tệp có đuôi .xlsx (Microsoft Excel) sử dụng MIME type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.

Cập nhật

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
MIME type cho .xlsx
Tài liệu
Danh mục
Không
Nén bằng gzip/Brotli

MIME type của tệp .xlsx là gì?

MIME type (kiểu phương tiện) của tệp Microsoft Excel có đuôi .xlsx là application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. Đây là kho lưu trữ ZIP chứa XML, đã được nén sẵn. Hãy phục vụ đúng kiểu này để trình duyệt giữ đuôi .xlsx khi tải xuống.

Header Content-Type

Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8

Các kiểu dựa trên văn bản nên kèm charset để trình duyệt giải mã ký tự đúng cách.

Cấu hình máy chủ

Máy chủCấu hình
Nginx (mime.types hoặc types {})application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
Apache (.htaccess)AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx
IIS (web.config)<mimeMap fileExtension=".xlsx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
Node.js / Expressres.type('xlsx') hoặc res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8')
Amazon S3Đặt Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet cho đối tượng (metadata), hoặc truyền --content-type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet vào aws s3 cp

Tệp .xlsx có nên nén không?

Không. Tệp Microsoft Excel vốn đã được nén bên trong, nên gzip hay Brotli sẽ lãng phí CPU và hầu như không giảm dung lượng — đôi khi còn làm tăng. Đừng đưa application/vnd.openxmlformats-officedocument.spreadsheetml.sheet vào cấu hình nén.

Vì sao MIME type quan trọng

Trình duyệt quyết định sẽ làm gì với phản hồi — hiển thị, thực thi, phát hay tải xuống — dựa trên header Content-Type, chứ không phải đuôi tệp. Với X-Content-Type-Options: nosniff, kiểu sai khiến stylesheet và script bị chặn hoàn toàn. Với tệp tải lên, đừng bao giờ tin kiểu do client gửi; hãy kiểm tra nội dung tệp (magic bytes) trên server.

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

MIME type của .xlsx là gì?
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
Làm thế nào để đặt Content-Type cho .xlsx trong Nginx?
Hãy đảm bảo application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; có trong khối types (thường nằm ở /etc/nginx/mime.types) rồi tải lại Nginx.
Có nên nén tệp .xlsx bằng gzip không?
Không — định dạng này đã được nén sẵn, nên nén HTTP không mang lại lợi ích nào.