How Strip path from http request URL into Rewrite or Redirect URL for Azure CDN Standard Rules?

Viewed 201

Hello and thanks for stopping by!

I want to forward to a different domain an incoming Http request into an Azure Microsoft CDN (standard rules), forward it either with url redirect or url rewrite - example:

Incoming http request url into cdn: https://cdn-domain.com/PATH-1

URL Redirect / Rewrite to: https://newdomain.com/SUBPATH/PATH-1/

I know what newdomain.com and SUBPATH are. I need to strip PATH-1 from the url request, is this possible? If not, the URL Rewrite rules may be able to do it with preserved unmatched path option but in this case what is the source pattern and destination regex to achieve the above url please?

enter image description here

I tried URL_Rewrite rule regex as below but rewritten url misses SUBPATH:

Rewrite Source pattern: /cdn-domain.com/(.*)

Rewrite Destination: /newdomain.com/SUBPATH/{R:1}

Cheers

0 Answers
Related