MIME type mapping
This page explains how MIME types (media types, content types) are mapped to file extensions in Magnolia.
MIME types are configured in
config:/server/MIMEMapping. You can edit
them with the Configuration
Example: The MIME type
text/html is mapped to extension
The example above shows just two types. Magnolia configures many more MIME types by default.
required Parent node name such as
required MIME type for the given file extension. See Official Media Types List.
optional File extension. If not set,
ContentTypeFilter does not set the response content type, instead it’s the responsibility of renderers/servlets to set correct content type (for instance FreemarkerRenderer sets the content type). However, ContentTypeFilter sets some parameters onto AggregationState and takes care of restricting responses to configured MIME types and matching requests to content types.
By default, Magnolia tries to respond to every request, even if the MIME
type is not configured. To restrict responses to configured MIME types
only, add a
registeredExtensionsOnly property to the
true Magnolia will respond with
400 to requests with extensions that are not registered in MIMEMapping.
If the request has no extension, Magnolia assumes it is
You can restrict responses to match content types with the
To force content type matching, add the
server/filters/contentType and set the value to
validateContentType property is set to
true, Magnolia will
400 if the requested extension does not match the content type. This
property essentially disables all unknown extensions.