10

I would like to use azure blob and CDN premium features but the documentation is very sparse. This is something totally doable on Amazon S3 / CloudFront.

For clarity I want *.azureedge.net/sample/index.html to equal*.azureedge.net/sample/ and *.azureedge.net/sample/test.html to equal to *.azureedge.net/sample/test

This is totally not clear and takes "up to 4 hours" to preview changes, so...

azure rules engine

After some investigation, Azure has a wrapper for Verizon Edgecast CDN, and this page looks identical to theirs...

glued
  • 2,579
  • 1
  • 25
  • 40
  • 2
    Last night I set up some experiments to try and understand how Azure CDN's URL Rewriting feature works, and of 9 different settings, the only ones that worked as expected were the 2 controls (no rewriting). I also have been completely unable to find any helpful documentation. – nbering May 23 '16 at 15:51

2 Answers2

12

Edgecast support gave me the following rules:

enter image description here

  • add a new rule IF Always
    • Feature
      • URL Rewrite - source ((?:[^\?]*/)?)($|\?.*) destination $1index.html$2
      • URL Rewrite - source ((?:[^\?]*/)?[^\?/.]+)($|\?.*) destination $1.html$2

I created an npm package to deploy a folder and subfolders to azure storage see https://github.com/glued/yokai theres some additional information about configuring the CDN for clean urls here: https://github.com/glued/yokai/blob/master/azure.md

glued
  • 2,579
  • 1
  • 25
  • 40
  • 1
    Thanks! Lack of escaping on the `/` characters suggests python-flavoured regex or something similar. Exploring this quickly with the regex tools on [Regex101.com](https://regex101.com), I found that the pair of expressions above handle `http://example.com/something/` and `http://example.com/something` ok, but if you actually want to point to a file, like say `http://exameple.com/image.jpg` it seems like it would behave strangely. If you don't mind, could you show some URLs and what they would be re-written to? – nbering May 26 '16 at 01:02
  • made some modifications, link back up http://makes.azureedge.net/fish/ for an example of an image and index and http://makes.azureedge.net/fish/test = test.html which also works – glued May 27 '16 at 17:07
  • i have few rules in web.config now i have to use CDN rule engine where i can learn create rewrite rules using rule engine for ex i need to redirect to external site when there is no file in url just domain name ? – Raghavendra Jun 08 '17 at 10:17
  • how to redirect both http and https the example.org and www.example.com to https:// www.example.org/home is there a tool to check the Regex before apply? "Approval of new Rules takes up to 4 hours." – Valentin Petkov Sep 12 '17 at 21:43
  • how to combine remove index.html with HTTP to HTTPS redirection? https://learn.microsoft.com/en-us/azure/storage/blobs/storage-https-custom-domain-cdn – Valentin Petkov Sep 19 '17 at 02:52
  • if you fell here looking for a solution like me. Try this.I Guarantee it works. Add a new rule Condition: URL file extension a. Operator: Less than b. Extension: 1 c. Case transform: No transform [This basically means that the URL requested has no file (extension) but is a route of the app which will be taken care of by the app routing] Action: URL rewrite a. Source pattern: / b. Destination: /index.html c. Preserve unmatched path: No Save rule Source: https://github.com/MicrosoftDocs/azure-docs/issues/43257 – Alexrgs Apr 15 '20 at 23:03
  • @Alexrgs The solution is for Azure CDN. Unfortunately for Verizon CDN we need to provide regex. – Jimit.Gandhi Nov 15 '20 at 08:56
3

I'm hesitant to post this as an answer. I ran out of time to actually try it out, but I found what appears to be a rules engine manual for verizon's CDN.

GlobalDots Knowledge Base - Edgecast Advanced HTTP Rules

There's a link near the top for a PDF guide.

HTTP Rules Guide PDF

It doesn't look like regular expressions. It's sort of in the spirit of pattern matching, but doesn't look as powerful or generic.

I haven't tried it out yet. It looks like a bit of work to decipher the documentation for use. There aren't many practical examples and the few it has leave me with more questions than answers. I'd love to hear how you make out with it.

nbering
  • 2,725
  • 1
  • 23
  • 31
  • 1
    Thanks, I'm currently in discussion with Edgecast support team to see if they can help and will post what they come back with. – glued May 23 '16 at 16:52
  • I've got an answer that works but i'm tweaking it a bit and will report back soon. – glued May 25 '16 at 01:12
  • @glued Did you had any luck with the Edgecast support? This quasi-regex thing is still driving mildly nuts. Thanks! – Joannes Vermorel Jan 15 '18 at 19:20
  • @joannes-vermorel their support staff may be able to provide additional guidance if you reach out directly. Unfortunately I ended up migrating my project to firebase which included the rewrites i needed out of the box – glued Jan 15 '18 at 23:57