According to wikipedia, it's text/plain
for .obj
.
I'm guessing it's text/plain
for .mtl
files as well, since there's text in them and since it "is a standard defined by Wavefront Technologies for ASCII files".
Question
I was building a little 3D-application using ThreeJS and WebGL. I purposely chose not to convert models into ThreeJS compatible .json files, instead started building an importer. It works, but I also planned to have the application decide what type of model has been loaded using both file extension and MIME type, the later if the first is unknown.
I've read somewhere that the MIME Type is supposed to be application/wavefront-obj
, which would be kind of weird since there is also the model
tree, but okay anyways. Though browsing the IANA website for this file type yields no results.
Am I missing something?
Solution
According to wikipedia, it's text/plain
for .obj
.
I'm guessing it's text/plain
for .mtl
files as well, since there's text in them and since it "is a standard defined by Wavefront Technologies for ASCII files".
OTHER TIPS
You need to update your web.config and add the reference to the obj file type
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".obj" />
<mimeMap fileExtension=".obj" mimeType="text/plain" />
</staticContent>
</system.webServer>
</configuration>
I was surprised to see nothing in the IANA database for wavefront obj files, considering that they've been kicking around the internet for 20 years at least. I'd be happy to collaborate with others in establishing an official MIME type.
Until then, according to section 3.3 of RFC 6838, "Personal or Vanity Tree", you can use your own media type for this, something like text/prs.wavefront-obj
, in addition to text/plain
. That way you can use the HTTP Accept
header to negotiate the appropriate MIME type in your response.
According to IANA, the association who defines and maintains media-types (this is not Wikipedia), the mime-type of "obj" is model/obj
, and model/mtl
for "mtl". See other media types for models: https://www.iana.org/assignments/media-types/media-types.xhtml#model
Use MIME type application/object
for .obj files. It works in Chrome, Safari, and FireFox.