Expand my Community achievements bar.

AEM As A Cloud Service - Dispatcher - Error page for multiple countries and languages

Avatar

Employee

Hi,

 

I'm working on the error page for multiple countries and languages. I'm using the ACS common for error handling and have one domain for all countries and languages.

Content structure : 

/content/company/de/en/....

/content/company/de/de/....

/content/company/fr/en/....

/content/company/fr/fr/....

 

I am implementing region specific vhost and rewrite rules.
For example
company.fr/en/home123.html -> company.fr/content/company/fr/en/home123.html.
Unfortunately, the error pages doesn't get mapped properly for 'FR'. Although, it works well for 'DE'.
ISSUE : Error page isn't mapped properly for the non-existing FR pages.
Observations :
  1. Doesn't work on the server dispatcher for FR, but works well on my local and server publsiher
  2. Error pages are available on server, if requested individually.
  3. Dispatcher configs and rewrite rules works fine for all the existing pages for DE and FR.
Attaching screenshots for references. Any suggestion would be helpful.
 
hiralshah_0-1657521797676.png

 

9 Replies

Avatar

Community Advisor

Hi,

In case of 404, you need to set status 404 and defined error pages for domains.

You can use the various conditions to defined page per domain.

 

The error pages can be hosted i AEM for each domain

 

<LocationMatch "/de/en/(.*)">
ErrorDocument 404 /de/en/404.html
</LocationMatch>
<LocationMatch "/fr/en/(.*)">
ErrorDocument 404 /fr/en/404.html
</LocationMatch>



Arun Patidar

Avatar

Employee

Hi Arun,

 

Thanks for the quick response.
I do have the ErrorDocument property set in the vhost files (both DE and FR) : 

DE vhost : ErrorDocument 404 /de/errors/404.html

FR vhost : ErrorDocument 404 /fr/errors/404.html

 

Thanks,

Hiral

Avatar

Community Advisor

@hiral-shah It should work with @arunpatidar  Solution. But if it is not working the issue is with some thing else.

And also i see fromt he screenshot attached

 

why on dispatcher we are rendering from /content/<name>/fr/content/<name>/fr/fr/home1234.html

 

What is the exact ur from publisher? There is some rule or any configuration that is redirecting /content/fr on top of /content/<name>/fr. Please check from that prespective

Avatar

Level 1

Hi Jagadeesh,

 

I am trying to find the reason for /content/<name>/fr on top of the URL.

But my main query is - the existing pages for FR are getting mapped properly with the same set of rules. Also, the response from the publisher is 404 and that is why the error page is getting mapped on publisher. 404 is responded to the dispatcher as well but error page is not mapped in this case.

 

Thanks,

Hiral

Avatar

Community Advisor

The error page you are receiving right now is from AEM. In this case custom the error page should be return. Can you also check if the error page is published or not?



Arun Patidar

Avatar

Level 1

Hi Arun,

The error pages are published and rendered properly when requested individually.

 

Also, I was checking the response headers for the existing and non-existing pages.

hishah123_0-1657606683583.png

It seems like the existing and non-existing pages are getting mapped properly at the fastly CDN ( x-cache being a fastly header). Let me know, in case my understanding is wrong.

 

Unfortunately, its at the Cloudflare CDN where this issue is happening.

Any suggestion?

 

Avatar

Community Advisor

what is the response code for non existing page?



Arun Patidar

Avatar

Level 1

Hi Arun,

 

The response status for non-existing pages is 404, for both fastly and cloudflare.

Avatar

Employee

Hello @arunpatidar @Jagadeesh_Prakash,

 

Here is the snippet from the log files : 

Dispatcher logs :
dispatcher access log - "GET /fr/testagain.html HTTP/1.1" 404 237 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"
aem dispatcher log - "GET /content/company/fr/fr/testagain.html" 40451ms [companypublishfarm/0] [actionnone] dev.company.fr

 

Publisher logs :
request log -
[792] -> GET /content/company/fr/fr/testagain.html HTTP/1.1
[792] <- 404 text/html 34ms
error log - GET /content/company/fr/fr/testagain.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /content/company/fr/content/company/fr/fr/testagain.html not found
access log - "GET /content/company/fr/fr/testagain.html HTTP/1.1" 404 455 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"

There is not much in the logs.