How to make Azure Rules Engine make all incoming uri paths lowercase? - azure

Currently I have tried a few different combinations.
Essentially what I need to do this this:
www.mydomain.com/mYpaTh needs to rewrite to: www.mydomain.com/mypath but it needs to do a toLowerCase for every incoming uri, essentially making the uris case insensitive. The method cannot effect query parameters or file extensions.
This needs to be done as a wildcard, not as a specific case, most examples found online have it for only one scenario, to set up as a basic url rewrite. I need it to be done as follows:
Incoming uri contains /[A-Z] then rewrite to /[a-z] - not sure if azure actually allows this. WIld cards don't seem to work for the standard subscription, but not sure if someone has made it work in some way. I was able to get this to work in AWS cloudfront using basic javascript toLowerCase method.
For example:
Azure CDN Rules Engine

Related

How to Redirect a URL using Application Gateway with Query included and Path excluded

I am not able to successfully redirect a URL with query to another target external URL.
eg:-
Request URL:- http://example123.com/xxx/yy?path=com
Target URL:- http://example456.com/zzz/yy
Condition:-
I need to include the query string from the Request URL but not the Path.
I have tried using the path-based routing rule on the App GateWay with below configuration
Redirect rule
But after hitting save its going back to a state like this:
Rule after save
Can anyone please find us a solution ??
According to configuration-request-routing-rules (github.com) ,
Path based rule may not send path to query and only applies it to path of url.
When you create a rule, you choose between basic and path-based.
Choose basic if you want to forward all requests on the associated listener (for example, blog.contoso.com/*) to a single back-end pool.
Choose path-based if you want to route requests from specific URL paths to specific back-end pools. The path pattern is applied only to
the path of the URL, not to its query parameters.
Also see external-site | Microsoft Docs
Please check if you can try the rewriting URL path instead of redirecting which refers to this tutorial for implementation.

Rewrite rule on application gateway azure

i would like to implement a rewrite rule on my Application Gateway v2 or other way if exist on Azure.
On application gateway i setup 2 path based rule for our main site that i call mywebsite.it deployed to webapp1:
1- if i reach mywebsite.it/function* it redirect traffic correctly to webapp2;
2- if i reach from mywebsite.it/myapplication*, for example mywebsite.it/myapplication/images/xyz the application start with mywebsite.it/function*. This rule point also to webapp2;
I would like to do this for scenario 2. From mywebsite.it/myapplication/images/xyz, apply a rewrite that change only /myapplication/, for example mywebsite.it/function/images/xyz. I need to mantain the path after function/* in rewrite operation(it is not static and change every time a user make a request when they pass from mywebsite.it/myapplication* )
I tried to configure the rewrite but it didn't work:
I can't try evaluate path map, becouse in our http setting applied to path base rules(is the same becouse web app is the same), override backend path is enabled with /. Without it application didn't work.
Any help is really appreciated
Would suggest you to please set the correct value for “Pattern to match” and “URL path value” and create the require object for HTTP header rewrite as it has stated according to the below Microsoft document. As it seems you have set wrong value for “Pattern to match” and “URL path value”.
Refer this: https://learn.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers-portal
The pattern to match is a regular expression. In regular expressions, the forward slash ("/") is a reserved character so it must be escaped with a backslash ("\"), so it should look like ("\/"). Use regex101.com to test your regular expression and ensure that you get a match when you expect it and no match when you do not expect it.

Multiple domains and web app in Business Catalyst

I have set up a secondary domain on my BC hosting successfully and have already set it up to point to a homepage and the url stays the way I wish, for example www.[secondary domain].com
I now want to setup a web app to use my secondary domain rather than my default, does anyone know how I would achieve this?
Fore example at present it looks like this www.[default domain].com/[webapp name]/ I would really want it to read www.[secondary domain].com/[webapp name]
I am going to have to use redirects when promoting the page and just accept that the proper url is going to be www.[default domain].com/[webapp name]/
BC serves all content the same, no matter which domain it is accessed from.
Proper server-side 301 redirects are unavailable, since BC gives us no method to discriminate by domain. You can perform a client-side 'redirect' though, after comparing the hostname in Javascript (with something like document.location.host).
There is also Liquid Markup, which you can use to detect the domain and vary the served content accordingly.
You'll need to ensure all links to the app are fully qualified, including the preferred domain.
I'd also add canonical links (<link rel="canonical" href="...">) to each page of the app. This will indicate the preferred domain to search engines.
Note the inverse is also a problem; content on your primary domain will also be accessible through the secondary domain, causing rank dilution / duplicate content issues.

How to prioritize IIS URL rewriting rules?

Is it possible to make URL rewriting rules executing with a specified priority order (i.e. one rules before another)?
it depends on your code, you manage it with your code.
i use "if else" structures and rewritepath method in my application_request event and manage my url rewriting.
but if you had some regular roles, so use the roles in web.config.
sometimes you had somthing like that
www.yoursite.com/products/34
and you want to rewite it into
www.yoursite.com/products.aspx?id=34
in these cases i offer to use the role in web.config.
but sometime it not as easily as this one.so use the application_request method and because you manually rewrite you path you can change their priority.
finally :
my offer is use the application_request event and rewrite your urls in this special case ;-)
if need more help comment then i will edit this answer dude.

Can IIS 6 serve requests for pages with no extensions?

Is there any way in IIS to map requests to a particular URL with no extension to a given application.
For example, in trying to port something from a Java servlet, you might have a URL like this...
http://[server]/MyApp/HomePage?some=parameter
Ideally I'd like to be able to map everything under MyApp to a particular application, but failing that, any suggestions about how to achieve the same effect would be really helpful.
You can set the IIS6 to handle all requests, but the key to handle files without extensions is to tell the IIS not to look for the file.
http://weblogs.asp.net/scottgu/archive/2007/03/04/tip-trick-integrating-asp-net-security-with-classic-asp-and-non-asp-net-urls.aspx
You can also create an ISAPI filter that re-writes urls. The user enters a url with no extension, but the filter will interpret the request so that it does. Note that in IIS it's real easy to screw this up, so you might want to find a pre-written one. I haven't used any myself so I can't recommend a specific product that's any different than what you'd find via google, especially as I don't know your specific use case. But at least now you know what to search for.
You can also rewrite your urls using ASP.Net:
http://msdn.microsoft.com/en-us/library/ms972974.aspx

Resources