Hi Folks,
I am trying to configure dispatcher for Geo location headers x-aem-client-country and x-aem-client-continent. But I don't see those are being added by CDN. Below are the changes that I made
farm file:
/headers {
"Cache-Control"
"Content-Disposition"
"Content-Type"
"Expires"
"Last-Modified"
"X-Content-Type-Options"
"x-aem-client-country"
"x-aem-client-continent"
}
in clientheaders.any file added
"x-aem-client-country"
"x-aem-client-continent"
Let me know if I am missing anything.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hello @Anudeep_Garnepudi ,
Did you also add the header in your vhost file. if not you need to set the headers in your vhost file. Here is a example.
<IfModule mod_headers.c> Header set x-aem-client-country "<value>"
Header set x-aem-client-continent "<value>" </IfModule>
I don't want to set the value or header, this header and value has to be set by CDN based on user Country and Continent.
Ahh, I misunderstood your question.
Try this:
You should be able to get the headers value once you add them to clientheaders.any file
Can you try retrieving the headers using req.getHeader("x-aem-client-country")
Please check the logs and verify the response are you getting
You should be able to get the header values if you checking on AEM cloud. It worked for me earlier
Please check with Adobe support as you are unable to get the values
Hi @Anudeep_Garnepudi
If you need the header in the cache header section as well in order to have this presented at the clientside all the time.
The /headers
property lets you define the HTTP header types that Dispatcher is going to cache. On the first request to an uncached resource, all headers matching one of the configured values (see the configuration sample below) are stored in a separate file, next to the cache file. On subsequent requests to the cached resource, the stored headers are added to the response.
Below is a sample from the default configuration:
/cache {
...
/headers {
"Cache-Control"
"Content-Disposition"
"Content-Type"
"Expires"
"Last-Modified"
"X-Content-Type-Options"
"Last-Modified"
}
}
I don't need this to be visible for client/end user (browser). Use case is, I want to write a rewrite rule based on client country.
HI @Anudeep_Garnepudi ,
If you have configured the dispatcher to add the `x-aem-client-country` and `x-aem-client-continent` headers, but they are not being added by the CDN, there could be a few potential reasons for this issue:
1. CDN Configuration: Ensure that your CDN is properly configured to pass through the headers specified in the dispatcher configuration. Check the CDN documentation or contact your CDN provider to verify that the headers are allowed and forwarded correctly.
2. Dispatcher Configuration: Double-check your dispatcher configuration to ensure that the headers are correctly specified. Make sure that the `clientheaders.any` file is properly included in the dispatcher configuration and that the headers are listed correctly.
3. Cache Invalidation: If the CDN is caching the responses, it's possible that the headers are not being added because the CDN is serving cached responses instead of making requests to the origin server. In this case, you may need to configure cache invalidation rules to ensure that the CDN fetches fresh content from the origin server.
4. Request Inspection: You can inspect the requests and responses using browser developer tools or tools like cURL to see if the headers are present in the requests and responses. This can help identify if the issue is with the CDN or the origin server.
5. CDN Support: Confirm with your CDN provider if they support passing through custom headers like `x-aem-client-country` and `x-aem-client-continent`. Some CDNs may have limitations on the headers they allow or require additional configuration steps.
If you have checked these points and the headers are still not being added, it may be helpful to reach out to your CDN provider or Adobe Support for further assistance. They can provide specific guidance based on your CDN and AEM configuration.
This is how we should get the header value in dispatcher.
%{HTTP:X-AEM-CLIENT-COUNTRY}
I was using like this %{HTTP_X-AEM-CLIENT-COUNTRY}, which didn't work.
Views
Likes
Replies
Views
Likes
Replies