# mp4와 js의 잘못된 MIME 유형 (Content-Type 헤더)

**URL:** https://meta.discourse.org/t/incorrect-mime-types-content-type-header-for-mp4-and-js/257802
**Category:** Bug
**Created:** [3월 11, 2023, 3:27오후 UTC](https://meta.discourse.org/t/incorrect-mime-types-content-type-header-for-mp4-and-js/257802 "2023-03-11T15:27:21Z")
**Posts on this page:** 1
**Showing post:** 16

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [1월 2, 2025, 5:04오후 UTC](https://meta.discourse.org/t/incorrect-mime-types-content-type-header-for-mp4-and-js/257802/16 "2025-01-02T17:04:24Z")

</div>

간단히 업데이트드립니다 -

위에서 언급한 우리가 사용하는 `ext_mime_db`는 [IANA 미디어 유형](https://www.iana.org/assignments/media-types/media-types.xhtml)을 따릅니다. 안타깝게도 이는 `mp4`가 `application/mp4`로 설정되는 것이 올바른 것임을 의미합니다 😅

 ![Screenshot 2025-01-03 at 12.51.40 AM](https://global.discourse-cdn.com/meta/original/4X/1/b/2/1b28ed3216f4be9d0a4ed7d501eae74ad4424fc0.png)

* * *

다만, S3 업로더 구현을 더 자세히 살펴보니 이미지 이외의 거의 모든 업로드에 [Content-Disposition](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) 헤더 `"attachment"`가 추가되고 있음을 확인했습니다. 이는 본래 svg 파일에만 추가될 의도였던 것으로 보입니다. `"attachment"`를 사용하면 콘텐츠가 새 탭에서 열리는 대신 다운로드됩니다. 영상의 경우 `application/video`와 `attachment`가 함께 사용되면서 이러한 문제가 발생하고 있습니다.

최소 이 헤더는 제거할 수 있을 것 같습니다.

> <https://github.com/discourse/discourse/pull/30535>
>
> Back then in https://github.com/discourse/discourse/commit/31e31ef44973dc4daaee2…f010d71588ea5873b53, we added the \[Content-Disposition\](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) headers so that SVGs get downloaded instead of get run in the browser. Inadvertently, this also causes other attachments like pdfs and videos to be downloaded instead of heeding the "Open in new tab" option that users choose in the browser.
> 
> \### Problem video with \`Content-Disposition: attachment\`:
> https://github.com/user-attachments/assets/f05d388f-4454-4615-9d5a-7a0a66fe3b52
> 
> When the header is removed, the default value is \`"inline"\`, this allows the browser to perform as requested. This also applies to other file types like pdfs, allowing users to "Open in new tab" and view them in the browser instead of always downloading them.
> 
> Existing tests (https://github.com/discourse/discourse/pull/10205) already do check that SVGs remain downloaded. Some existing tests written for PDFs have been modified to cater for SVGs instead, when there was a bug in defining the filenames per https://github.com/discourse/discourse/pull/10108

---

_[View the full topic](https://meta.discourse.org/t/incorrect-mime-types-content-type-header-for-mp4-and-js/257802)._
