I have a blog on WordPress, which I have converted into ASP.NET Core. I am using Azure Service App. As it's a blog, so it has a lot of images, around 4GB of images. For now, I have placed these images in the wwwroot folder. Now I want to transfer them to Blob storage.
But problem is that, when I add images in Blob, I get a different link. I have used Azure CDN and have tried custom domain. But here the issue comes is:
My Service App is running at www..com
I am able to redirect my Blob CDN to images..com .... I have added it in the DNS record
But what I want is to use the same domain www..com for both Blob and Service App, which I tried my best but couldn't achieve. The main reason is I couldn't add multiple CNAME for www.
Why I can't change the link, coz it will affect my blog's SEO, so I can't take that risk. Need help.
Thanks in advance.
what I want is to use the same domain www..com for both Blob and Service App
This is not possible you can use sub-domain on your CDN Endpoint and main domain on service app.
Create CDN.
Add custom sub-domain on CDN Endpoints. For example :- if your domain www.abc.com then you can use cdn.abc.com, image.abc.com, photo.abc.com etc.
More information about Add Cutom Domain on CDN read these Microsoft document.
SO thread on same issue It is not possible to provision same domain for different service
Related
I got a website hosted in go daddy. The domain is using CPANEL.
Made a new Azure Blob Storage with another part of the website.
My current domain is www.mydomain.com, I added a new redirect from market.mydomain.com to Azure Blob. It works.
The problem is that when the redirection happens, the URL changes to azure's blob URL. What im trying to do here is to keep the DNS name pointing to Azure BLOB.
Channel seems to offer no access to CNAME configuration tho.
That is something that could be done in other providers using httaccess. Azure Blob has its own syntax, could not figure out examples on what should be configured to make this work.
What is the default configuration for Azure Blobs to handle redirections keeping the url ?
Thanks !
first off i want to thank you all for the amazing information on here, i have learnt so much!
so the issue i have is i need to create a static web page for when we have a whole site down, as we host general maintenance pages on word press.i need to have multiple domains redirected to this web site when this issue occurs. the way i was thinking of doing it , is create a storage account then add to a static website to that storage container. then place the web page in a CDN adding multiple domains. then adding a cname record in DNS pointing to that endpoint? would this work?
many thanks in advance
Unfortunately map multiple custom domains directly to storage accounts website is not currently supported
https://feedback.azure.com/forums/217298-storage/suggestions/955579-enable-multiple-custom-domains-for-storage-account
You can integrate a Storage Account static website with Azure CDN and map a custom domains.
https://learn.microsoft.com/en-us/azure/cdn/cdn-map-content-to-custom-domain?tabs=azure-dns%2Cazure-portal%2Cazure-portal-cleanup
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?)
Is there any way to host static website (HTML + CSS + JS) in Azure? Like we do Amazon S3 Static Website hosting, they charge only for storage.
UPDATE: 29-June-2018
It is now possible to host static websites in Azure Storage. You can read more about it here: https://learn.microsoft.com/en-gb/azure/storage/blobs/storage-blob-static-website
As of today, no. Azure doesn't have an equivalent of that. You can however host static sites as Web Apps and for free as well if you're comfortable with the restrictions with free tier.
It's not officially supported, but if you hosted your site in Azure Blob Storage's root container and made the container publicly accessible, you could probably achieve the same affect. You can even give the blob storage account a custom domain name.
Only downside is that you'll have to figure out a good deployment story. Two of your options are to use an FTP-like client such as CloudBerry to manually deploy your site, or write your own deployment script using the blob storage api
I found a way to host a static website in an Azure blob, using a subdomain and an http re-direct
I do the following
1) In Azure I create a storage account with a container ( called docs ) that has Blob access policy.
2) I upload my static website to the docs container using the storage explorer. This includes some PHP files in a sub folder.
3) In the DNS I set up a cname record for a subdomain ( called info say) with alias myblob.blob.core.windows.net ( where myblob is the name of my blob)
4) In the DNS I create an Http redirect for record to a file on the subdomain for www with url http://info.mydomainname.com/docs/index.html
5) In Azure I create a custom domain for info.mydomainname.com
My website then works however if someone knows the location of the PHP files then they can download them which means I must not store secrets in them.
I have asked if there is a work around here
I have some HTML widgets hosted on an Azure website. I would like to move these to a different Azure website.
Unfortunately, the mobile apps that consume these widgets are referencing their Azure sub-domain name directly. Example: old_widgets_site.cloudapp.net
Now I would like to shut down the old location where the widgets are hosted and move over to a new Azure website. Example: new_widgets_site.cloudapp.net :)
Is there a way for me to shut down the old website while still supporting the older mobile apps? Or do I have to keep the old app alive so I can host some kind of URL redirect mechanism on it?
PS - I know it's much better to reference a "virtual" domain name and have that redirect to Azure using DNS CNAMEs and I will. My question is not about that, but about redirecting *.cloudapp.net sub-domains.
To my understanding there is no option within Azure Web Sites to configure a redirect from within the portal.
What you could do is keep the old Web Site active and replace the content with a URL redirect statement in the web.config file (See: http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module). Of course that does mean you need to keep the old Web Site active.
Maybe you want to submit this idea using the Azure Feedback Forums: http://feedback.azure.com/