AEM Dispatcher ErrorDocument URL not showing up | Community
Skip to main content
Rohan_Garg
Community Advisor
Community Advisor
August 5, 2022
Solved

AEM Dispatcher ErrorDocument URL not showing up

  • August 5, 2022
  • 3 replies
  • 7834 views

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 - 

 



This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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

 

 

3 replies

arunpatidar
Community Advisor
Community Advisor
August 5, 2022

Hi,

Try changing this to below so that it matches your rules.

ErrorDocument 404 /errors/404.html

 

Arun Patidar
Rohan_Garg
Community Advisor
Community Advisor
August 5, 2022

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"

arunpatidar
Community Advisor
Community Advisor
August 5, 2022

I think,

This is not executing otherwise you could you please check dispatcher logs, try debug logs?

ErrorDocument 404 /errors/404.html

 

Arun Patidar
Level 2
August 5, 2022

Hi @rohan_garg ,

Can you Please try checking the DispatcherPassError is updated in vhost,

It should be set to DispatcherPassError 404 in this case.

Reference: https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/getting-started/dispatcher-install.html?lang=en

Rohan_Garg
Community Advisor
Community Advisor
August 5, 2022

@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.

arunpatidar
Community Advisor
Community Advisor
April 27, 2023

@arunpatidar I get below screen not the page i have added in ErrorDocument

 

 


ok this message is not from AEM. There might be another service(maybe CDN) showing this message.

Arun Patidar
arunpatidar
Community Advisor
Community Advisor
August 5, 2022

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

 

 

Arun Patidar