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

File berakhiran .xlsx (Microsoft Excel) menggunakan tipe MIME application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.

Diperbarui

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Tipe MIME untuk .xlsx
Dokumen
Kategori
Tidak
Kompres dengan gzip/Brotli

Apa tipe MIME dari file .xlsx?

Tipe MIME (media type) untuk file Microsoft Excel dengan ekstensi .xlsx adalah application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. Berupa arsip ZIP berisi XML; sudah terkompresi. Sajikan dengan tipe persis ini agar browser tetap mempertahankan ekstensi .xlsx saat diunduh.

Header Content-Type

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

Tipe berbasis teks sebaiknya menyertakan charset agar browser menguraikan karakter dengan benar.

Konfigurasi server

ServerKonfigurasi
Nginx (mime.types atau 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') atau res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8')
Amazon S3Atur Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet pada objek (metadata), atau teruskan --content-type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ke aws s3 cp

Apakah file .xlsx perlu dikompres?

Tidak. File Microsoft Excel sudah terkompresi secara internal, jadi gzip atau Brotli hanya membuang CPU dan hampir tidak mengurangi ukuran, bahkan kadang menambahnya. Jangan sertakan application/vnd.openxmlformats-officedocument.spreadsheetml.sheet dalam konfigurasi kompresi kamu.

Mengapa tipe MIME penting

Browser memutuskan apa yang dilakukan terhadap sebuah respons (ditampilkan, dijalankan, diputar, atau diunduh) berdasarkan header Content-Type, bukan ekstensi file. Dengan X-Content-Type-Options: nosniff, tipe yang salah membuat stylesheet dan script langsung diblokir. Untuk unggahan, jangan pernah percaya tipe yang dikirim klien; periksa isi file (magic bytes-nya) di server.

Pertanyaan yang sering diajukan

Apa tipe MIME untuk .xlsx?
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
Bagaimana cara mengatur Content-Type untuk .xlsx di Nginx?
Pastikan application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; sudah ada di blok types (biasanya di /etc/nginx/mime.types), lalu muat ulang Nginx.
Apakah file .xlsx perlu di-gzip?
Tidak. Formatnya sudah terkompresi, jadi kompresi HTTP tidak memberi manfaat.