Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: MOTION-157

...

Example: The MIME type text/html is mapped to extension html. The type application/x-javascript is mapped to extension js.

...

enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse

Image Added

...

Mgnl f
server

...

Mgnl f
MIMEMapping

...

Mgnl n
html

...

Mgnl p
mime-type

...

Mgnl n
foobar

...

Mgnl p
mime-type

...

Mgnl p
ext

...

The example above shows just two types. Magnolia configures many more MIME types by default.

...

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 contentType filter configuration: 

Image Added

Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node namevalue

Mgnl f
server

 

Mgnl f
filters

 

Mgnl f
contentType

 

Mgnl p
class

info.magnolia.cms.filters.ContentTypeFilter

Mgnl p
enabled

true

Mgnl p
registeredExtensionsOnly

true
Info

When registeredExtensionsOnly is true Magnolia will respond with response code 400 to requests with extensions that are not registered in MIMEMapping. 

If the request has no extension, Magnolia assumes it is html.

...

To force content type matching, add the validateContentType property in server/filters/contentType and set the value to true.

...

enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse

...

Mgnl f
server

...

Mgnl f
filters

...

Mgnl f
contentType

...

Mgnl p
class

...

Mgnl p
enabled

...

Mgnl p
registeredExtensionsOnly

...

Mgnl p
validateContentType

...

Image Added

Info

When the validateContentType property is set to true, Magnolia will respond with response code 400 if the requested extension does not match the content type. This property essentially disables all unknown extensions.