Expand my Community achievements bar.

SOLVED

AEM dispatcher works for a direct request to a file, but fails with a 404 on a request to a directory

Avatar

Level 1

When I go to:

www.example.com/us/index.html  the request works as expected. See dispatcher log below:

[Wed Sep 02 11:48:45 2015] [D] [20333(1121016128)] Found farm website for www.example.com
[Wed Sep 02 11:48:45 2015] [D] [20333(1121016128)] checking [/us/index.html]
[Wed Sep 02 11:48:45 2015] [D] [20333(1121016128)] never flushed [/opt/example/unsecure/.stat] -> use cache [/opt/example/unsecure/us/index.html]
[Wed Sep 02 11:48:45 2015] [D] [20333(1121016128)] cache-action for [/us/index.html]: DELIVER
[Wed Sep 02 11:48:45 2015] [D] [20333(1121016128)] request declined
[Wed Sep 02 11:48:45 2015] [I] [20333(1121016128)] "GET /us/index.html" - - 0ms

 

 

However, when I go to the directory directly and not the file I get a 404:

www.example.com/us/  results in a 404. See dispatcher log below:

[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] Found farm website for www.example.com
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] checking [/us/]
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] request URL has no extension: /us/
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] cache-action for [/us/]: NONE
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] Filter rejects: GET /us/ HTTP/1.1
[Wed Sep 02 11:46:48 2015] [I] [20333(1121016128)] "GET /us/" - - 1ms
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] Found farm website for www.example.com
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] checking [/apps/pagenotfound/404.shtml]
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] cache-action for [/apps/pagenotfound/404.shtml]: DELIVER
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] request declined
[Wed Sep 02 11:46:48 2015] [I] [20333(1121016128)] "GET /apps/pagenotfound/404.shtml" - - 0ms
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] Found farm website for www.example.com
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] checking [/apps/pagenotfound/master-app-config.html]
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] never flushed [/opt/example/unsecure/.stat] -> use cache [/opt/example/unsecure/apps/pagenotfound/master-app-config.html]
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] cache-action for [/apps/pagenotfound/master-app-config.html]: DELIVER
[Wed Sep 02 11:46:48 2015] [D] [20333(1121016128)] request declined

 

 

In my apache configuration I have DirectoryIndex index.html defined within my <Directory "/opt/example/unsecure">  section and hitting the directory was functioning before I enabled dispatcher.

 

 

Any ideas? Thanks.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

as Opkar said, you should add a Rewrite Rule to redirect requests to a directory to a more sensible URL (e..g request for / is redirected to /home.html)

kind regards,
Jörg

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi,

as Opkar said, you should add a Rewrite Rule to redirect requests to a directory to a more sensible URL (e..g request for / is redirected to /home.html)

kind regards,
Jörg

Avatar

Employee

Hi James,

I'll leave it to someone else to comment on the Apache config, but as you have seen for the log file. Apache has passed the request to Dispatcher to handle and it returns a 404 as there is no extension. Even going directly to the URL in AEM you would not be able to access a resource with a trailing "/". Unless you had a rewrite rule in your Apache config to convert this. This article shows how to do it[1], albeit for all URL requests.

Regards,

Opkar

[1] http://www.citytechinc.com/us/en/blog/2013/04/extensionless-urls-in-adobe-experience-manager.html