Virtual URI mapping issues

DirectoryWatcher overflow

A DirectoryWatcher overflow warning can help you pinpoint the roots of an overflow. It is logged when there are more than 500 configured virtual URI mappings in light modules.

If a DirectoryWatcher overflow error occurs (MAGNOLIA-7762), try to:

  • Keep the number of files in a single folder below 100.

  • Use folder hierarchies whenever possible.

i18n breaks virtual URI mapping for paths starting with a language tag

You have a virtual URI mapping configuration similar to what’s shipped with the tours module of the Magnolia Travel Demo:

/tours/virtualUriMappings/travelToursMapping.yaml
class: info.magnolia.virtualuri.mapping.RegexpVirtualUriMapping
fromUri: ^/(.*/)?tours(.*).html
toUri: forward:/$1travel/tour?tour=$2

Provided en is the default language, you may see that requests for pages without the language tag in the path (/tours/magnolia-travels/Kyoto.html) work correctly, while those where the tag is part of the path (/de/tours/magnolia-travels/Kyoto.html) fail.

Add a bypass of the i18n filter

A solution adopted for example in the Magnolia 6.2.12 Demo webapp.
/server/filters/
...
  i18n:
    class: info.magnolia.cms.i18n.I18nContentSupportFilter
    enabled: true
    bypasses:
      BypassWhenForward:
        class: info.magnolia.voting.voters.ForwardVoter
  cache:
    class: info.magnolia.module.cache.filter.CacheFilter
    defaultContentCachingConfigurationName: defaultPageCache
  virtualURI:
    class: info.magnolia.virtualuri.VirtualUriFilter
    enabled: true
...

This approach can only be used:

Additionally, set /modules/cache/config/contentCaching/<your-configuration>/cachePolicy@includePersonalizedDescendants to true. This makes sure that personalized components are part of page cache key. Otherwise, you would always get the first page version.

Change the filter order

In this solution (adopted in the Magnolia 6.2.13 Demo webapp), the bypass of the i18n filter is removed but the order of filters has changed:

/server/filters/
...
  virtualURI:
    class: info.magnolia.virtualuri.VirtualUriFilter
    enabled: true
  i18n:
    class: info.magnolia.cms.i18n.I18nContentSupportFilter
    enabled: true
  cache:
    class: info.magnolia.module.cache.filter.CacheFilter
    defaultContentCachingConfigurationName: defaultPageCache
...
Redirects aren’t cached.

You are probably not affected

If a tours-like mapping isn’t used in your project or you don’t use language variants, keep the following order of filters:

/server/filters/
...
  i18n:
    class: info.magnolia.cms.i18n.I18nContentSupportFilter
    enabled: true
  cache:
    class: info.magnolia.module.cache.filter.CacheFilter
    defaultContentCachingConfigurationName: defaultPageCache
  virtualURI:
    class: info.magnolia.virtualuri.VirtualUriFilter
    enabled: true
...
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules