I want to implement the below redirection in Azure AppGateway v1
https://first.demo.com/home/ => https://second.demo.com/home/
is this doable? If so, how do I do it?
A simple redirection to an external site can be achieved on Application gateway v1 but not a URL rewrite.
Reference : https://learn.microsoft.com/en-us/azure/application-gateway/redirect-overview
Application Gateway v2 and WAF v2 SKU supports the capability to add, remove, or update HTTP request and response headers, while the request and response packets move between the client and back-end pools. You can also rewrite URLs, query string parameters and host name. You can use server variables to evaluate rewrite conditions and rewrite headers.
Reference :
https://learn.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers-url
https://learn.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers-portal
HTTP header and URL rewrite features are only available for the Application Gateway v2 SKU. So you cannot achieve the above requirement using Application gateway v1.
Important points to consider:
In the case of a URL rewrite, Application Gateway rewrites the URL before the request is sent to the backend. This will not change what users see in the browser because the changes are hidden from the user.
In the case of a URL redirect, Application Gateway sends a redirect response to the client with the new URL. That, in turn, requires the client to resend its request to the new URL provided in the redirect. The URL that the user sees in the browser will update to the new URL.
If you wish to upgrade your Application gateway from v1 sku to v2 sku, an Azure PowerShell script is available in the PowerShell gallery to help you migrate from your v1 Application Gateway/WAF to the v2 Autoscaling SKU. This script helps you copy the configuration from your v1 gateway. Traffic migration is still your responsibility.
For more information, please refer : https://learn.microsoft.com/en-us/azure/application-gateway/migrate-v1-v2
Related
Is the following URL rewrite supported in Azure App Gateway v1?
https://app.demo.com/myWeb/ redirects https://app.demo.com/my/
If so, how do I implement the same?
Update:
we are using app gateway v1 and from what I've read, it's not supported there. but URL rewrite is supported in v2
Yes that is correct URL rewrite feature is only available on Application Gateway v2 SKU. You can follow the documentation here to implement rewrite URL path.
I have an azure front door which has custom frontends/domains, backend-pools, and routing rules configured to use azure web apps as backends. When i go the website the request passes through front door as it should and picks the best available backend, but it displays the azure webapp's url on the browser from the backend pool and not the azure front door domain. I expect to have the frontend/domain in the browser when i am directed to the backend and do not display the azure web app's url in the browser.
For example,
when i go to www.mysite.com, i want it to be like www.mysite.com/foo (displaying the content from backend web app) and not mywebapp.azurewebsites.net/foo
Any guidance on how it can be achieved or is it possible to achieve?
The Azure front door just does a simple URL forwarding for the incoming client traffic. After my validation, if we select the forwarding protocol to HTTPS only, the address bar will not display the backend URL when you access the front door URL.
However, you actually still see the real backend domain in the set-cookie.
For more information, you could read the Backend host header and a similar question here1 and here2.
THis is possible using the forward feature in AFD, but if you are using redirects then the actual backend URL will be shown of course, so configure basic Forwarding and the AFD URL is the one that will be shown at all times
I'd need the following config on Azure:
requests to www.domain.com goes to an App Service (call it MainAppService)
requests to www.domain.com/blog/* to a different App Service (call it BlogAppService)
It is important that the url stays www.domain.com/blog/something (a simple redirect to blog.domain.com/something won't work for me here).
MainAppService is a .Net Core app while BlogAppService should be php (yes, WordPress). I wonder if Azure Application Gateway is the only option. Any code based solution without the need to install AAG?
As far as I know, if you want a code-based solution, you may consider adding URL rewrite rules in web app service. It seems that Rewrite Rules only works in one web app service. That is, you could not redirect HTTP-host www.domain.com to blog.domain.com based on rewrite rule.
As your configuration, I think Azure application gateway is an easy and better way to make it.
Configuration example:
Create an application gateway with path-based routing rules using the Azure portal
How to map URL path-based rules in application gateway for your Azure web app service
I'm configuring Azure Application Gateway Url based routing for my two back-end pools and it is not working.
My default routing configuration is pointing to b1 end point and it is reachable by blabla.cloudapp.azure.com
When I add additional route path /b1/* I cannot access my back-end pool via blabla.cloudapp.azure.com/b1/. I get 404 page not found response.
Can anyone please help me to understand what is wrong with my configuration?
Azure Application Gateway URL Based routing will route different requests to different groups of servers (backend pools) based upon the URL of the request. Once the request is sent to a VM, it is received and treated like a normal web request. If the URL you are accessing is a Valid web URL for the web server that is receiving the request, then it will return a proper response.
The fact that you are getting a 404 error means that your web servers are receiving the request, but not finding anything at the requested location. One way you can troubleshoot this is to log onto the VM that should be receiving the request and trying the request in a browser replacing blabla.cloudapp.azure.com/with localhost/.
In the example you posted, you would need a folder from within your web directory called "b1" for the URL you specified to be a valid request.
You can use a Path-Based Rule to specify the default backend pool, as well as specific URL paths that should be sent to other backend pools. Here is an example of how to configure a Azure Application Gateway with URL based routing in the Portal.
Is it possible to have an kind of api gateway to redirect requests for different web apps?
Foe example:
Domain: abc.com
Abc.com/ -> abc-com-home.azurewebsites.net
Abc.com/map -> abc-com-map.azurewebsites.net
And every request in teh apps should use rhe same pattern.
Thank you!
Is it possible to have an kind of api gateway to redirect requests for different web apps?
Per my understanding, you could leverage the Set backend service policy to redirect an incoming request to the related back-end. Also, you could leverage the path-based rule for the application gateway with your azure web apps to distribute your request(s) to the relevant azure web app. Details, you could follow here.
Abc.com/ -> abc-com-home.azurewebsites.net Abc.com/map -> abc-com-map.azurewebsites.net
Per my understanding, I would map a custom domain (Abc.com) for abc-com-home.azurewebsites.net, then I would leverage the URL Rewrite for my abc-com-home.azurewebsites.net to redirect the request(s) to the related azure web apps based on the request path.
Yes, the application gateway can do it, but you must do it via powershell. If you need SSL, the you must configure for end to end ssl since webapps cant be a a virtual network.
https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-web-app-powershell