Artifactory provides a flexible mechanism to manage content type/MIME Type. You can define system-wide MIME types for common usage, but you can also overwrite the MIME types for specific files as needed. You can find the list of default MIME types in
$JFROG_HOME/artifactory/var/etc/artifactory/mimetypes.xml and can be edited in order to add, remove or change MIME types.
If a file has an extension that is not supported by any of the MIME types, or does not have an extension at all, Artifactory will use the default MIME type of
application/octet-stream. To determine an artifact's MIME type, Artifactory compares its extension with the those in the
mimetype.xml file, and applies the MIME type of the first extension that matches.
MIME Type Attributes
Each MIME type have the following attributes.
The MIME type unique name (mandatory)
A comma separated list of file extensions mapped to this MIME type (mandatory)
True if this MIME type should be indexed for archive searching (valid only for supported archive files)
True if this MIME type is a browsable archive
True if this MIME type can be viewed as a text file inside Artifactory UI
The UI highlighter syntax to for this MIME type (only relevant if this is a
The css class of a display icon for this mime type
The following example shows a mimetype.xml file.
<mimetypes version="4"> <mimetype type="text/plain" extensions="txt, properties, mf, asc" viewable="true" syntax="plain"/> <mimetype type="text/html" extensions="htm, html" viewable="true" syntax="xml"/> <mimetype type="text/css" extensions="css" viewable="true" syntax="css"/> <mimetype type="text/xsl" extensions="xsl" viewable="true" syntax="xml"/> <mimetype type="text/xslt" extensions="xslt" viewable="true" syntax="xml"/> <mimetype type="text/x-java-source" extensions="java" viewable="true" syntax="java"/> <mimetype type="text/x-javafx-source" extensions="fx" viewable="true" syntax="javafx"/> </mimetypes>
For the example, from the extensions parameter in the above mimtypes.xml file sample we can conclude that:
test.properties is a text/plainMIME type
application/octet-streamMIME type since
docis not included in any of the other MIME types.
Make sure you restart Artifactory for your changes to take affect.
Artifactory MIME Types
Some of the Mime-Types specified in
mimetypes.xml (e.g. application/x-checksum) are used by Artifactory. Great care should be taken before changing these Mime-Types to ensure Artifactory continues to function correctly.
Setting Content-Type During Download
Using Artifactory, when downloading files you can override the
Content-Type HTTP header by setting the
artifactory.content-type property. If the
artifactory.content-type property is not explicitly set, Artifactory will use the default mechanism of matching the artifact name extension to the extensions in the
mimtypes.xml file to apply the Content-Type.
This feature is only available with Artifactory Pro.