ÃÛ¶¹ÊÓÆµ

Geolocation response headers not reflecting client IP location in AEMaaCS

Geolocation headers in HTTP responses from ÃÛ¶¹ÊÓÆµ Experience Manager as a Cloud Service (AEMaaCS) fail to reflect the actual client location. Attempts to configure geolocation using a cdn.yaml file result in deployment errors due to incorrect structure or use of reserved header names. To resolve the issue, update the CDN configuration and test from a valid IP.

Description description

Environment

ÃÛ¶¹ÊÓÆµ Experience Manager as a Cloud Service (AEMaaCS) – Sites (Development)

Issue/Symptoms

  • Geolocation headers like X-AEM-Client-Country return placeholder values.
  • Headers fail to appear in HTTP responses from the publish endpoint.
  • Deployment errors occur due to incorrect cdn.yaml structure or reserved header names.
  • Responses do not reflect the expected country for Spanish IP addresses.

Resolution resolution

To resolve the issue, follow these steps:

  1. Ensure the cdn.yaml file is located at /config/cdn.yaml in your Cloud Manager Git repository. Avoid any extra subfolders or typos in the path.

  2. Edit the cdn.yaml file to use a custom header name instead of reserved prefixes like x-aem-. For example, use Client-Country and define the transformation rule as follows:

    code language-none
    kind: "CDN"
       version: "1"
       metadata:
       envTypes: \[ "dev"]
       data:
       responseTransformations:
       rules:
       * name: add-country-header
         when: "\*"
         actions:
         * type: set
           respHeader: "Client-Country"
           value: "{reqHeader:x-aem-client-country}"
           \
    
  3. Commit the changes and deploy the configuration using Cloud Manager. Ensure the pipeline completes without YAML syntax or header naming errors.

  4. Test the setup using a VPN or external network with an IP address from the target country (for example, Spain). This ensures the CDN injects accurate geolocation headers into HTTP responses based on IP.

  5. Run a DNS lookup on your publish endpoint to verify it’s routed through ÃÛ¶¹ÊÓÆµâ€™s CDN. Then, use a verbose curl -I -v <publish-url> command to check for CDN-related headers like x-cache or via.

  6. Ensure no intermediate systems (for example, dispatcher or caching layers) strip required headers before transformation.

If the issue persists, check pipeline logs for errors or warnings and verify the request’s IP address. Investigate further if intermediate systems interfere with header injection or transformation.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f