Hi AEM Community,
I have the below Error Document vhost configuration written for my site -
ErrorDocument 404 /content/xyz/us/en/errors/404.html
When I am hitting an incorrect URL my dispatcher logs show the below -
172.17.0.1 "localhost" - [05/Aug/2022:07:16:25 +0000] "GET /content/xyz/us/en/abc.html HTTP/1.1" 301 233 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
172.17.0.1 "localhost" - [05/Aug/2022:07:16:25 +0000] "GET /abc.html HTTP/1.1" 404 2425 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
[05/Aug/2022:07:16:25 +0000] "GET /content/xyz/us/en/abc.html HTTP/1.1" 404 none [publishfarm/0] 13ms "localhost"
The above entries are due to the below redirect rules -
RewriteRule ^/content/xyz/us/en/(.*)$ /$1 [NE,L,R=301]
RewriteRule ^/(.*)$ /content/xyz/us/en/$1 [NC,PT,L]
However, once the redirection occurs and 404 was encountered I was expecting the logs to redirect to error page as defined in ErrorDocument directive.
Can anyone please suggest what is wrong in this ?
Currently the request passes to publish and is served with the below -
Solved! Go to Solution.
Hi, I tried in local with docker image it worked for me.
Here are my changes in
1. created new vhost file at /dispatcher-sdk-2.0.104/src/conf.d/available_vhosts/aemlab.vhost, it is a copy of /dispatcher-sdk-2.0.104/src/conf.d/available_vhosts/default.vhost but added
<LocationMatch /> ErrorDocument 404 /content/aemlab/404.html ErrorDocument 403 /content/aemlab/403.html ErrorDocument 500 /content/aemlab/500.html </LocationMatch>
2. unlink /dispatcher-sdk-2.0.104src/conf.d/enabled_vhosts/default.vhost
3. created symblink ln -s /dispatcher-sdk-2.0.104/src/conf.d/available_vhosts/aemlab.vhost /dispatcher-sdk-2.0.104/src/conf.d/enabled_vhosts/default.vhost
4. executed below command
./bin/validator full -d ./out ./src
./bin/docker_run.sh ./out host.docker.internal:4503 8080
Hi,
Try changing this to below so that it matches your rules.
ErrorDocument 404 /errors/404.html
Hi @arunpatidar , Thanks for the quick reply.
Modified the Error Document URL but still getting the same issue
172.17.0.1 "localhost" - [05/Aug/2022:08:15:01 +0000] "GET /content/xyz/us/en/home-page/abc.html HTTP/1.1" 301 243 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
172.17.0.1 "localhost" - [05/Aug/2022:08:15:01 +0000] "GET /home-page/abc.html HTTP/1.1" 404 2435 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
[05/Aug/2022:08:15:01 +0000] "GET /content/xyz/us/en/home-page/abc.html HTTP/1.1" 404 none [publishfarm/0] 11ms "localhost"
I think,
This is not executing otherwise you could you please check dispatcher logs, try debug logs?
ErrorDocument 404 /errors/404.html
My dispatcher is running as a docker container image.
The dispatcher logs give the below -
[05/Aug/2022:08:36:12 +0000] "GET /content/abc/us/en/rgarg.html HTTP/1.1" 404 none [publishfarm/0] 13ms "localhost"
[05/Aug/2022:08:36:12 +0000] "GET /favicon.ico HTTP/1.1" 404 none [publishfarm/0] 13ms "localhost"
httpd_access logs give the below -
172.17.0.1 "localhost" - [05/Aug/2022:08:36:12 +0000] "GET /content/xyz/us/en/rgarg.html HTTP/1.1" 404 2423 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
172.17.0.1 "localhost" - [05/Aug/2022:08:36:12 +0000] "GET /favicon.ico HTTP/1.1" 404 2370 "http://localhost/content/xyz/us/en/rgarg.html" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
My dispatcher is running as a docker container image.
Where do I find the debug logs for dispatcher ?
The logs you will see from the cmd screen but you have to change the log level. That you can do it from conf file
https://hub.docker.com/r/aemcloud/dispatcher
https://blogs.perficient.com/2017/10/12/mastering-aem-dispatcher-part-1-debugging-the-dispatcher/
Not able to really change the log level for the container image.
Is there any other suggestion on how we can troubleshoot this further ?
I think something is wrong with your redirect rules.
Try one thing, removed all redirect rules and try to hit non existing page and then see if that page is getting triggered or not, make sure 404 page existing in AEM
I tried that, removed all the redirects to hit on an invalid URL, got the similar log -
172.17.0.1 "localhost" - [05/Aug/2022:10:53:13 +0000] "GET /content/xyz/us/en/dummyURL.html HTTP/1.1" 404 2419 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
[05/Aug/2022:10:53:13 +0000] "GET /content/xyz/us/en/dummyURL.html HTTP/1.1" 404 none [publishfarm/0] 9ms "localhost"
For valid URL the log is -
172.17.0.1 "localhost" - [05/Aug/2022:10:54:18 +0000] "GET /content/xyz/us/en/home-page.html HTTP/1.1" 200 11445 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
[05/Aug/2022:10:54:18 +0000] "GET /content/xyz/us/en/home-page.html HTTP/1.1" 200 none [publishfarm/0] 343ms "localhost"
So even without any redirects the ErrorDocument is not picking up the page path.
The page exists when I hit it directly with complete URL its accessible.
172.17.0.1 "localhost" - [05/Aug/2022:10:55:21 +0000] "GET /content/xyz/us/en/errors/404.html HTTP/1.1" 200 5693 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
[05/Aug/2022:10:55:21 +0000] "GET /content/xyz/us/en/errors/404.html HTTP/1.1" 200 none [publishfarm/0] 211ms "localhost"
I will try this and let you know
@arunpatidar - Here's an interesting observation from further troubleshooting -
There's a redirect rule in my files as follows -
RewriteRule ^/$ /content/xyz/us/en/home-page.html [R=301,L]
This is basically redirecting the root URL to the home-page.html
I was trying to implement extension less URLs and made the below change -
#RewriteRule ^/$ /content/xyz/us/en/home-page/ [R=301,L]
When I now hit the root request I got redirected to the error page -
Here are the logs -
172.17.0.1 "localhost" - [05/Aug/2022:14:58:16 +0000] "GET /?rootRequest=true HTTP/1.1" 301 273 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
172.17.0.1 "localhost" - [05/Aug/2022:14:58:16 +0000] "GET /content/xyz/us/en/home-page/?rootRequest=true HTTP/1.1" 301 240 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
[05/Aug/2022:14:58:16 +0000] "GET - HTTP/1.1" - - [-] 0ms "localhost"
172.17.0.1 "localhost" - [05/Aug/2022:14:58:16 +0000] "GET /errors/404.html HTTP/1.1" 200 5693 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0"
[05/Aug/2022:14:58:16 +0000] "GET /content/xyz/us/en/errors/404.html HTTP/1.1" - miss [publishfarm/0] 219ms "localhost"
But if I comment the entire rules section then also I am not getting the error directive's error page. From what I can see if the request at publish is an incorrect URL the dispatcher gives the error directive's page else whenever the request maps to publish and gives 404 it spools the same error response thus ignoring the error directive.
Any ideas on this ?
Hi,
Something si wrong from you r redirect rules, I will suggest to check those separately first. Once all url works fine then moved to error page part.
Hi @Rohan_Garg ,
Can you Please try checking the DispatcherPassError is updated in vhost,
It should be set to DispatcherPassError 404 in this case.
@achennapragada - Thanks for the response.
DispatcherUseProcessedURL On
DispatcherPassError 1
The DispatcherPassError is set to 1. As the documentation says the following -
Dispatcher does not spool an error response to the client (where the status code is greater or equal than 400), but passes the status code to Apache, which e.g. allows an ErrorDocument directive to process such a status code.
Hi, I tried in local with docker image it worked for me.
Here are my changes in
1. created new vhost file at /dispatcher-sdk-2.0.104/src/conf.d/available_vhosts/aemlab.vhost, it is a copy of /dispatcher-sdk-2.0.104/src/conf.d/available_vhosts/default.vhost but added
<LocationMatch /> ErrorDocument 404 /content/aemlab/404.html ErrorDocument 403 /content/aemlab/403.html ErrorDocument 500 /content/aemlab/500.html </LocationMatch>
2. unlink /dispatcher-sdk-2.0.104src/conf.d/enabled_vhosts/default.vhost
3. created symblink ln -s /dispatcher-sdk-2.0.104/src/conf.d/available_vhosts/aemlab.vhost /dispatcher-sdk-2.0.104/src/conf.d/enabled_vhosts/default.vhost
4. executed below command
./bin/validator full -d ./out ./src
./bin/docker_run.sh ./out host.docker.internal:4503 8080
@arunpatidar - Thanks for your help! I followed the same and it worked!
It has to be the redirect rules which are giving this issue then.
Thanks a lot for your help!
@arunpatidar Its working for 404 error but not for 500 error page, can you please help me with this?
What do you see when it is 500 error?
ok this message is not from AEM. There might be another service(maybe CDN) showing this message.
Is there any way to override CDN response if we want?