Skip to main content
Level 2
Jan 21, 2026 2:38 PM UTC

Manipulating path while routing the request through vpn configurations

Hi Community,

 

I want to define a rule in the cdn.yaml using the origin selector as described in the documentation https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/cdn-configuring-traffic#origin-selectors that would route the traffic for a particular path to an external website (www.website.com).

Something similar to 

originSelectors:  rules:    - name: blogs      when:        allOf:          - reqProperty: tier            equals: publish          - reqProperty: domain            equals: <our domain>          - reqProperty: path            matches: "^/en-us/prefix/.*"

However, prior the routing I want to manipulate the path, so the /prefix part is eliminated and for the /en-us/prefix/page path it would send a request to www.website.com/en-us/page.

We have this logic working at the dispatcher tier using the ProxyPass directive. I am trying to understand if the same logic can be handled at the cdn level.

 

Regards,

Rustam 

9 replies

konstantyn_diachenko
Community Advisor
Community Advisor
Jan 21, 2026 3:34 PM UTC

Hi ​@user62746 ,

 

Personally, I don’t know how can we achieve it on CDN level, because the originSelectors don’t provide request transformation capabilities so far according to the documentation.

There is another workaround with redirect, but, apparently, it doesn’t fit you. You can have a try.

kind: "CDN"
version: "1"
metadata:
envTypes: ["dev", "stage", "prod"]
data:
redirects:
rules:
- name: redirect-with-prefix-to-new-domain
when:
allOf:
- { reqProperty: tier, equals: "publish" }
- { reqProperty: domain, in: [ "www.example.com", "www.example.com" ] }
- { reqProperty: path, matches: "^/en-us/prefix/.*" }
action:
type: redirect
location:
reqProperty: url
transform:
- op: replace
match: '^(/en-us)/prefix(/.*)'
replacement: 'https://www.example.com/\1\2'

 

Translate
Kostiantyn Diachenko, Community Advisor, Certified Senior AEM Developer, creator of free AEM VLT Tool, maintainer of AEM Tools plugin.
user62746Author
Level 2
Jan 21, 2026 3:42 PM UTC

Hi ​@konstantyn_diachenko ,

Thank you very much! I overlooked this option and will definitely give it a try.

I will keep you posted as soon as I would be allowed to test it in the CS environment.

 

Update: Unfortunately, it worked as expected and actually redirected my request to the external website. 

I will try to check with Adobe if this is possible currently possible.

 

Regards,

Rustam

Translate
user62746Author
Level 2
Jan 22, 2026 6:33 AM UTC

Hi,

 

Adobe has confirmed that this is not possible currently.

 

The originSelectors configuration in AEM as a Cloud Service lets us choose which origin to route to based on path/regex, but it doesn’t currently let us rewrite the path segment (for example, remove /posts) before forwarding to the external origin.

 

Translate
konstantyn_diachenko
Community Advisor
Community Advisor
Jan 22, 2026 5:14 PM UTC

​@user62746 , Thank you for confirmation. I assumed it too.

Translate
Kostiantyn Diachenko, Community Advisor, Certified Senior AEM Developer, creator of free AEM VLT Tool, maintainer of AEM Tools plugin.
MukeshYadav_
Community Advisor
Community Advisor
Jan 22, 2026 6:10 PM UTC

Hi ​@user62746 ,
As per document, order of evaluation https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/cdn-configuring-traffic#order-of-evaluation
If requirement is similar to ProxyPass instead 301 browser redirect, it can be possible with two steps solution

The CDN evaluates Request Transformations (modifying the path) first, and then evaluates Origin Selectors .

By using a Variable, we can ensure that only the  expected requests are affected (proxy), keeping the rest of AEM site safe.

kind: "CDN"
version: "1"
metadata:
envTypes: ["dev", "stage", "prod"]
data:
# STEP 1: Transform the path and "mark" the request
requestTransformations:
rules:
- name: transform-external-path
when:
allOf:
- reqProperty: tier
equals: publish
- reqProperty: path
matches: "^/en-us/prefix/(.*)"
actions:
# This removes /prefix/ and keeps the rest of the URL via the backreference \1
- type: transform
reqProperty: path
op: replace
match: "^/en-us/prefix/(.*)"
replacement: "/en-us/\1"
# This sets a temporary internal flag (variable)
- type: set
var: "proxy_to_website"
value: "true"

# STEP 2: Route based on the "mark" set in Step 1
originSelectors:
rules:
- name: route-to-external-origin
when:
var: "proxy_to_website"
equals: "true"
action:
type: selectOrigin
originName: external-website-origin

origins:
- name: external-website-origin
domain: www.website.com


Thanks,
Mukesh

Translate
konstantyn_diachenko
Community Advisor
Community Advisor
Jan 23, 2026 6:25 PM UTC

Hi ​@MukeshYadav_ , is requestTransformations executed before originSelectors?

Translate
Kostiantyn Diachenko, Community Advisor, Certified Senior AEM Developer, creator of free AEM VLT Tool, maintainer of AEM Tools plugin.
MukeshYadav_
Community Advisor
Community Advisor
Jan 24, 2026 4:03 AM UTC

Hi ​@konstantyn_diachenko ,

Yes, order of evaluation is mentioned here https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/cdn-configuring-traffic#order-of-evaluation

Flow Diagram - CDN AEMaaCS

Thanks

Translate
MukeshYadav_
Community Advisor
Community Advisor
Jan 22, 2026 6:16 PM UTC

Deleted

Translate
MukeshYadav_
Community Advisor
Community Advisor
Jan 22, 2026 6:44 PM UTC

Deleted

Translate