question

Rem-0323 avatar image
0 Votes"
Rem-0323 asked GitaraniSharmaMSFT-4262 answered

Behaviour of URL rewrite rule & purge

Background:
I am serving a react app through Azure CDN (standard Microsoft), with an Azure Storage Static Website as origin. On the CDN, I'm using a URL rewriting rule to write the react routes to index.html, as described here: https://stackoverflow.com/a/59585005

Problem:
I'm experiencing strange behaviour after purging the CDN (all content using '/*'). Some routes are returning the updated content and some are returning the old content. e.g. 'mydomain.com/' returns the new content, but 'mydomain.com/route' returns the old content.

How does Azure CDN behave when purging content for URL rewritten paths? Is there any additional handling/conditions that needs to be set?
E.g. for the Azure CDN Verizon offering, it seems it is needed to exclude purge requests by user-agent: https://github.com/Azure/azure-cli/issues/6722. Is there similar for the Microsoft offering?

azure-cdn
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @Rem-0323 ,

Apologies for the delay in response.

As per this article, wildcard purge is supported on Azure CDN from Microsoft and there are no other limitations.
The only limitation is related to query strings as below:

In Azure CDN from Microsoft, query strings in the purge URL path are not considered. If the path to purge is provided as /TestCDN?myname=max, only /TestCDN is considered. The query string myname=max is omitted. Both TestCDN?myname=max and TestCDN?myname=clark will be purged.

I have reached out to the PG team to validate if there are any other constraints related to Azure CDN purge for URL rewritten paths. I will get back to you once I hear from them.

Thanks,
Gita


0 Votes 0 ·

1 Answer

GitaraniSharmaMSFT-4262 avatar image
0 Votes"
GitaraniSharmaMSFT-4262 answered

Hello @Rem-0323 ,

As per this article, wildcard purge is supported on Azure CDN from Microsoft and there are no other limitations.
The only limitation is related to query strings as below:

In Azure CDN from Microsoft, query strings in the purge URL path are not considered. If the path to purge is provided as /TestCDN?myname=max, only /TestCDN is considered. The query string myname=max is omitted. Both TestCDN?myname=max and TestCDN?myname=clark will be purged.

I contacted Azure CDN PG team and they confirmed the below:

Cache key is based on the incoming URL. Even if you rewrite the URL, you should purge based on the original URLs.

So your issue seems to be a purging issue from the backend. Hence, if you have a support plan, I request you file a support ticket, else please do let us know, we will try and help you get a one-time free technical support.

Kindly let us know if the above helps or you need further assistance on this issue.


Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.