404 filter rules seo

Some pages are not displayed in Live

Question

Some pages are displayed in Live and the access returns an errorHTTP 400.

Cause

In the Jahia.log, the following error is displayed as below:

2016-09-07 15:54:39,421: INFO [Render] - Rendered [/cms/render/live/sites/unine/home/formation/formation-continue/FS/water-and-sanitation-engineering.html] user=[guest] ip=[130.125.9.200] sessionID=[8C17026C02A68A2BE1EB377393C7CF5E] in [6ms]
2016-09-07 15:54:39,421: WARN [ErrorLoggingFilter] - [Error code: 400]: Unknown locale

The locale is not added in the render URL as it should be as below:

2016-08-31 11:27:33,311: INFO [Render] - Rendered [/cms/render/live/fr/sites/unine/home/formation/formation-continue/FS/water-and-sanitation-engineering.html] user=[root] ip=[127.0.0.1] sessionID=[4710867F25E21F4AAA242F00E2D653B1] in [1470ms]

 

Solution

The key was to enable the debug traces for this package: org.tuckey.web.filters

After comparing our debug traces to the customer's debug traces, we noticed that there was a difference regarding the regular expressions of two inbound rules:
- the two rules of the seo-urlrewrite.xml of the customer's environment:

<rule>
<note>Add language to URL if not present (no context)</note>
...
<condition type="request-uri" operator="notequal">^/(cms/)?.+?/[a-z]{2}(_[A-Z]{2})?/.*</condition>

 

<rule>
<note>Add language to URL if not present (with context)</note>
...
<condition type="request-uri" operator="notequal">^(/[\p{Alnum}\-_]*)/(cms/)?.+?/[a-z]{2}(_[A-Z]{2})?/.*</condition>


the same two rules in our environment:

<rule>
<note>Add language to URL if not present (no context)</note>
...
<condition type="request-uri" operator="notequal">^/(cms/)?[a-z]{2}(_[A-Z]{2})?/.*</condition>

 

<rule>
<note>Add language to URL if not present (with context)</note>
...
<condition type="request-uri" operator="notequal">^(/[\p{Alnum}\-_]*)/(cms/)?[a-z]{2}(_[A-Z]{2})?/.*</condition>