Azure CDN controls engine to add default EXCEPT document for files requested by site

I use the Azure Verizon CDN to publish my web application (SPA) from the blob storage. I have successfully configured my own domain and SSL. I added a rewrite rule in the CDN to redirect it to the default index.html document. Essentially, it accepts an incoming request and inserts "index.html" between the URL path and any query lines. So mydomain.com/startupgoes tomydomain.com/startup/index.html

mydomain.com/homepage goes to mydomain.com/homepage/index.html

and also mydomain.com/showuser/?userId=xxxxxgoes tomydomain.com/showuser/index.html/?userid=xxxxx

Everything seems to be working well.

Existing rule for adding a default document

The URL in the address bar used by the SPA never requests the actual file, but the code in the default document index.html does. And all these file requests fail with 404 because I think the rewrite rule also applies to them.

What I want is some way not to rewrite the URL if the URL contains a file name. The rules mechanism does not allow me to add such a condition when using the URL rewrite function - obviously, you cannot use any matching conditions for the URL when trying to use the URL rewrite function.

Error trying to use condition associated with URL file name

+5
source share
3 answers

I was looking for the answer to this question. In the end, I had to participate in Azure support.

IIS, CDN URL-, . , SPA- ., , URL, .. , .

-, CDN Verizon Premium CDN SKU Azure. SKU, .

  • CDN Azure , Verizon.
  • HTTP Large.
  • .
  • IF Always.
  • + , .
  • URL- .
  • CDN. CDN CDN, .
  • [^?.]*(\?.*)?$. URL . , , .
  • origin_path/document.ext. . . , CDN /origin_path index.html, origin_path/index.html. , CDN Azure, .
  • "", , N , .
+6

. "IF Always" Azure. , User-Agent, .

"" "", :

  • "IF" → " " → : "-" → " " → "ECPurge/*" → :

  • .

: https://github.com/Azure/azure-cli/issues/6722

+1

, , :

404, ,

, , , , . ?

, , :

 http://example.com/resource/myresource.pdf

, - :

 http://example.com/resource/index.html/myresource.pdf

... therefore when referring to a resource, if you use a relative path, it will look something like this.

<a href="/resource/myresource.pdf">my resource</a>

If I misunderstood your question or problem, or it does not solve your problem, add the full error you get in the developer console (F12), including what the URL should be, and how to convert it when you encounter the problem .

0
source

Source: https://habr.com/ru/post/1688581/


All Articles