We’re using Cloudflare to load balance an Azure Storage Account with Static Site enabled. I need to implement a URL Rewrite Transform to rewrite all angular-routes to / or /index.html
We do this today with Verizon CDN with the following regex:
I figure I’m not the first one doing rewrites for angular routes here so I thought I’d ask.
Thank you for asking.
I am afraid you cannot use regular expressions in Transform Rules if not at least on a Business plan.
From what I understand, it looks for dot files inside a directory (if so), and then what?
Thanks for the info, we are an enterprise customer. I’m able to select regex when creating the transform.
The supplied regex basically looks for anything lacking a ‘.’ aka .jpg / .svg / .js
and rewrites it to index.html
Maybe you might have to re-write your regex to RE2 as I think it doesn’t support
? (guessing / looking for)
Otherwise, combine “OR” operator to get it correct (if path contains .jpg and something OR path contains svg and something …)… might have to try it out first and reply back here
Yeah I’ve been looking for an online RE2 parser to play around with. Thanks for the info.
As far as Cloudflare uses RE2 and RE2 is lacking of lookaheads (Syntax · google/re2 Wiki · GitHub), should be like:
→ not anything that goes like “dot” something
But with exclusion as don’t.match even
https://www.domain.com/index.html, as we might end up in a loop and as far as we rewrite to this.
Rewrite them to
Interesting, I’ll give this a shot, thanks for the example!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.