I've setup Azure Front door with a rule that if the request URL contains a value I want it to rewrite the URL to append /cmms to the end of the URL.
For example if the URL is the static URL azure assigns to the app demo.azurewebsites.net I want it to go to dev.mysite.com/cmms
Currently if I just type in dev.mysite.com then it loads but missing the /cmms.
It also is not automatically redirecting from the azure app url to the dev.mysite.com url either.
Any pointers would be appreciated. I'm not using an application gateway, only front door.
Related
Currently, our website is hosted on the SAP cloud and we have a lot of redirects that are handled by SAP. We just upload the files which contain the URL redirects and SAP internally takes care of the redirect. More details can be found here - https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/0fa6bcf4736c46f78c248512391eb467/d88300faa78f4acfabb5f4d344070778.html?version=v2011
We are moving the website from SAP to Azure and I know we can handle URL redirects in Azure Frontdoor but I don't think Azure Frontdoor can 10000+ redirects. Is there an alternative to Azure Frontdoor which can handle such huge redirects or is there any other tool outside Azure that can handle such huge redirects?
Simulated the new front door application with SAP routing rules
Step1:
Creating new front door classic application
Step2:
Under the Routing Rule, we can add multiple routing configuration on Front door
example for multiple route configurations:
refer this tutorial for more information
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 have setup an azure app gateway with path based routing and two back end pools pointing at app services.
I have setup www.mywebsite.com/site1 and www.mywebsite.com/site2
If you access www.mywebsite.com/site1 the site loads but site resources 404. Resources are pointing at www.mywebsite.com/images/logo.jpg rather than www.mywebsite.com/site1/images/logo.jpg.
I assume I need to use an app gateway url rewrite rule to rewrite the response to point to the correct path. Is that correct? and if so how do I do this?
You could configure application gateway for URL path www.mywebsite.com/site1 like this:
Add a Path-based routing rule
Path /site1/*
Target name targentname1
HTTP settings httpsetting1
backend target backendpool1
Override backend path with /images/ in the httpsetting1.
Hope this works.
I want to to be able to serve a SPA using just the Azure Front Door / and not Azure CDN. Looks like the Front Door provides the caching that the CDN would provide and I can add multiple regional storage accounts to it, making it global at scale.
The problem is, I can't match the path to index.html files. Found this feedback and it looks like this can be solved using the URL rewrite and redirect but couldn't figure out how.
I have /test/ and /test to match with the route below, so it should be matching /test and pointing the request to /test/index.html but this is not working. Can we not do file-based forwards?
This took some time to figure out but here's the solution.
Create Blob Storage(s)
To host the SPA you'll need blob storage accounts in Azure and these storage accounts should be configured to receive static webpage traffic. Navigate to Settings and then Static website in the blob storage settings.
To add content here - navigate to your blob storage again and you should see a container named $web.
Now the $web container is the one that you should put all your static files in, just make sure it's publicly accessible (depending on how you created it, it might not be)
More documentation on how to make a static website using blob storage is here: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website
Get the static website endpoint
Once you enabled the static website and click on the static website blade, it should give you a different endpoint than the regular blob access endpoint - one that supports the static website. Something that looks like: https://somerandomstorageaccount.z8.web.core.windows.net/
Add the static website endpoint(s) to Azure Front Door as back-end
Navigate to your Front Door designer
Navigate to your Back-end pool and add a new entry if you don't have anything.
You should now add this new website endpoint as a back-end to your Azure Front Door. Picture below is the update configuration, but adding it is equally simple, you just add it as a Custom Host back-end type and point it to your blob static website location.
To enable better performance, use multiple storage accounts (from different regions) and add all of those to back-end in your Front Door configuration and turn-on the caching in Front Door.
#Mavi Domates' answer above is great, but doesn't address how to make an SPA route correctly using Blob Storage.
Root Cause: Blob Storage's static website doesn't rewrite URLs and returns back 404 for SPA routes that don't exist exactly in the storage container.
Azure CDN Fix:
Create URL Rewrite rules to forward any zero-length file extensions back to index.html. Link
Azure Front Door Workaround:
(Notice this says Workaround... this is not a fix). On your Blob Storage Static website config, set both the Index document name and Error document path to index.html. This causes any 404 error to be redirected to your SPA entrypoint. Your SPA will work, but any direct navigation to a SPA endpoint will return a 404. (This carries a whole host of other problems, but at least the site works, right?)
I have two web apps setup in Azure, and for simplicity let's call them webapp1 and webapp2. They sit behind an application gateway, which is selecting the correct web app based on the subdirectory in the URL.
Here's a basic example of how I've set it up:
www.mydomain.com -> webapp1 (the default route)
www.mydomain.com/app -> webapp2
This is working fine, except for one problem: if webapp2 redirects to the login page, for example, the domain in the URL changes to the azurewebsites.net domain. Instead of redirecting to www.mydomain.com/login, it's going to webapp2.azurewebsites.net/login.
I'm fairly new to Azure application gateway, but I know it injects the x-forwarded-* and x-original-host headers. I assumed the gateway would either alter the redirected url request to correct the domain or the config on the web app would use the x-original-host instead. Neither of these things are happening.
Is there a way to configure either the web app or the gateway to make sure the host name doesn't change on redirects? Would this scenario work better with a separate web app/VM with a classic IIS reverse proxy setup instead of the application gateway?
Currently Application Gateway would not overwrite the response from the backend. We do inject X-Original-Host and your application should use that to write the redirect URL correctly back to mydomain.
Example to configure URL rewrite on web app can be found here. An example of rewriting default *.azurewebsites.net domain to a custom domain can be found here