Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Issues with etc/map redirect

Avatar

Level 2

Hi,

 

Application is not resolving urls without slash at the end.

 

http://cmsdev-www.ca.test/fr/abctest/
http://cmsdev-www.ca.test/fr/abctest

Dispatcher_log (/fr/abctest)

[Fri Aug 25 06:48:37 2023] [D] [pid 1914890] checking [/fr/abctest]

[Fri Aug 25 06:48:37 2023] [D] [pid 1914890] request URL has no extension: /fr/abctest

[Fri Aug 25 06:48:37 2023] [D] [pid 1914890] cache-action for [/fr/abctest]: NONE

[Fri Aug 25 06:48:37 2023] [T] [pid 1914890] Filter rule entry /0001 blocked 'GET /fr/abctest HTTP/1.1'

[Fri Aug 25 06:48:37 2023] [D] [pid 1914890] Filter rejects: GET /fr/abctest HTTP/1.1

[Fri Aug 25 06:48:37 2023] [I] [pid 1914890] "GET /fr/abctest" - blocked [testcapublishfarm/-] 9ms

Dispatcher_log (/fr/abctest/)

[Fri Aug 25 06:50:56 2023] [D] [pid 2065911] checking [/content/test/external/ca/fr/abctest.html]

[Fri Aug 25 06:50:56 2023] [T] [pid 2065911] Cache rule entry /0000 allowed '/content/test/external/ca/fr/abctest.html'

[Fri Aug 25 06:50:56 2023] [D] [pid 2065911] cachefile does not exist: /opt/aem/apache/htdocs/ca/content/test/external/ca/fr/abctest.html

[Fri Aug 25 06:50:56 2023] [D] [pid 2065911] try to create new cachefile: /opt/aem/apache/htdocs/ca/content/test/external/ca/fr/abctest.html

[Fri Aug 25 06:50:56 2023] [D] [pid 2065911] cache-action for [/content/test/external/ca/fr/abctest.html]: CREATE

[Fri Aug 25 06:50:56 2023] [T] [pid 2065911] Filter rule entry /0028 allowed 'GET /content/test/external/ca/fr/abctest.html HTTP/1.1'

[Fri Aug 25 06:50:56 2023] [T] [pid 2065911] request.uri = "/content/test/external/ca/fr/abctest.html"

Dispatcher isn't receiving the full path, so I am assuming that this is something with the etc/mappings? I checked for resourceresolver logs as well, but there is nothing coming up for urls without slash, so I am assuming it is not able to resolve it..

Below is redirect config for this path and it does not seems to an issue. What could be the cause for this?

nitishchawla_1-1695742838020.png

 

nitishchawla_0-1695742783113.png

 

Thanks in advance!!

 

6 Replies

Avatar

Community Advisor

@nitishchawla ,

 

Please check your dispatcher filter rules and also rewrite rules. In this example, your filter rule /0001 should allow "/fr/abctest*"  for it to work.

As per the dispatcher logs above, The request is getting rejected at the dispatcher itself before reaching to the publish server for /etc mapping resolution.

Avatar

Level 2

@Sudheer_Sundalam 

 

Thank you for your response.

 

Regarding the first log entry for both which is before the 'filter block' log, it isn't a full path. Doesn't that mean it isn’t able to resolve the path before going to dispatcher?

Below is the filter rule and that is a default one. Could it be due to path coming to dispatcher?
## deny everything and allow specific entries
## Start with everything blocked as a safeguard and open things customers need and what's safe OOTB
/0001 { /type "deny" /url "*" }

Avatar

Community Advisor

@nitishchawla ,

 

The general flow of request is as below:

1) Dispatcher virtual host is picked based on the domain name and the rewrites are processed.

2) The rewrite processed urls are then matched against filter rules in the dispatcher.

3) If the processed URL is not denied by any filter rule, then the dispatcher cache is checked to serve any cached content for that URL.

4) Finally if no cache is found, the URL comes to publish server where /etc mappings are resolved and response is sent back to dispatcher.

 

In your case, check if any of the rewrite urls are appending / at the end of the url. If that is the intended behavior, then added a new url in the dispatcher filter to allow.

Example: /00XX {/type "allow" /url "/fr/abctest*"}

You need to restart the apache server after adding the new allow rule to take effect and also clear the cache.

Avatar

Level 2

Below has been added. Restarted server and cleared the cache as well, but it is still showing as /0001 blocked.

##Allow URLs ending with slash
/0205 { /type "allow" /url "/fr/*" }

Side note: Below is already working as expected, when I manually use full path.
https://cmsdev-corp.ca.test/content/test/external/com/fr/abctest

Avatar

Level 2

That helped in understanding the process.

 

I enabled a debugger on rewrite rules through a medium article which helped in finding the root cause.

 

Avatar

Community Advisor

@nitishchawla ,

I am glad my pointers helped you in understanding the process. I would suggest you to write an article or blog explaining the problem and various steps/approach you have followed to solved while it is still fresh in your mind. This would help fellow developers.

 

Thanks,

Sudheer.