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

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

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
arunpatidarCommunity AdvisorAccepted solution
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
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