Kiểu MIME của file .odt là gì?
Kiểu MIME (media type) của file văn bản OpenDocument có đuôi .odt là application/vnd.oasis.opendocument.text. Đây là định dạng của LibreOffice Writer, dựa trên ZIP.
Header Content-Type
Content-Type: application/vnd.oasis.opendocument.text
Cấu hình máy chủ
| Máy chủ | Cấu hình |
|---|---|
Nginx (mime.types or types {}) | application/vnd.oasis.opendocument.text odt; |
Apache (.htaccess) | AddType application/vnd.oasis.opendocument.text .odt |
IIS (web.config) | <mimeMap fileExtension=".odt" mimeType="application/vnd.oasis.opendocument.text" /> |
| Node.js / Express | res.type('odt') or res.setHeader('Content-Type', 'application/vnd.oasis.opendocument.text') |
| Amazon S3 | Đặt Content-Type: application/vnd.oasis.opendocument.text cho object (metadata), hoặc truyền --content-type application/vnd.oasis.opendocument.text vào aws s3 cp |
File .odt có nên nén không?
Không. File văn bản OpenDocument đã được nén sẵn bên trong, nên dùng gzip hay Brotli chỉ tốn CPU và hầu như không giảm dung lượng — đôi khi còn làm tăng. Hãy loại application/vnd.oasis.opendocument.text khỏi cấu hình nén của bạn.
Vì sao kiểu MIME quan trọng
Trình duyệt quyết định cách xử lý 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 file. Với X-Content-Type-Options: nosniff, kiểu sai khiến stylesheet và script bị chặn hoàn toàn. Với file tải lên, đừng bao giờ tin kiểu do client gửi; hãy kiểm tra nội dung file (magic bytes) trên máy chủ.
Tra cứu kiểu MIME
Tìm kiếm mọi đuôi file và kiểu MIME phổ biến, kèm header Content-Type sẵn sàng sao chép.
Câu hỏi thường gặp
Kiểu MIME của .odt là gì?
application/vnd.oasis.opendocument.text.Làm thế nào để đặt Content-Type cho .odt trong Nginx?
application/vnd.oasis.opendocument.text odt; có trong khối types (thường nằm ở /etc/nginx/mime.types) rồi tải lại Nginx.