Azure Blob DNS Redirect from CPANEL - azure

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 !

Related

Single domain for Azure Blob and Servcice App

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

Host static website on Azure without $web in URL

Following instructions in Static website hosting in Azure Storage and Add a custom domain to your endpoint I've managed to get a static website with a custom domain and https (albeit with a "www" subdomain) via Azure CDN.
However, the blob endpoint ends "/$web/index.html" and that is also required to access the custom domain. So it is of the form:
https://www.<customdomain>.com/$web/index.html
Because of the SPA framework I'm using, that immediately becomes:
https://www.<customdomain>.com/$web/index.html#/home
which is a bit long.
I see instructions for handling https on root custom domains and may give that try if I'm feeling brave. But is there a way to suppress the /$web/index.html part? Currently, if I go to:
https://www.<customdomain>.com
I get:
<Error>
<Code>InvalidQueryParameterValue</Code>
<Message>Value for one of the query parameters specified in the request URI is invalid. RequestId:...</Message>
<QueryParameterName>comp</QueryParameterName>
<QueryParameterValue/>
<Reason/>
</Error>
Instead of mapping your custom domain to regular blob endpoint (e.g. https://mystorageaccount.blob.core.windows.net/), please try to map it to static website endpoint which looks something like https://mystorageaccount.z22.web.core.windows.net.
Once you do that, then you will not need to specify $web in your requests as this endpoint always picks up the content from $web blob container.
You can find the static website endpoint for your storage account in going into Static website section for your storage account in Azure Portal.

Godaddy and Azure CDN CName [duplicate]

I have now successfully setup my static website in a CDN,
Is there a way to specify that index.html is the default document ?
It is a 1 page site I just would like to browse to the root url without having to type /index.html ..
Thank you
Based on your previous question, I am assuming that you have set CDN to map to blob storage. If this is correct, unfortunately it is not possible as of today because Azure Storage does not have a support for default document. This is one of the most requested feature on Azure Feedback - https://feedback.azure.com/forums/217298-storage/suggestions/1180039-support-a-default-blob-for-blob-storage-containers however it is still pending.
If you want, you can create a proper website (instead of having this index.html file in blob storage) and serve that website via CDN. You can find more details about it here: https://azure.microsoft.com/en-in/documentation/articles/cdn-websites-with-cdn/.
Microsoft is working on this. At the moment you have only two possibilities to solve this:
Use CDN: With the premium version of Verizon you can create rules like Redirect Rules
Create an Web-App which act as a proxy and serves/redirects (to) blobs
Using Premium CDN
If you purchased the premium version of Verizon CDN then you can create custom Rewrite rules. You'll find this in the "Advanced Features" section of your CDN endpoint. Once you click on "Manage" you will be redirected outside the portal where you can manage your cdn.
Hier you must create a redirect rule like this:
Note that each change in a rule takes about 5 hours to be activated.
To check if your redirect rule works you can install IIS and activate the URL Rewrite Module. In the Rewrite Module you can test your rules.
Open IIS
Open Url Rewrite Module
Add Rule
Add blank rule
Test Pattern
Please note that if you test your pattern, it must begin with the CDN source path which is a number and your endpointname like /829292/movies.
Sometimes redirect rules causes problems with CDN Purging. You can solve this isssue by adding an if clause in your rule which says that redirect should only be active if it is not the purge agent.
This is now possible with Static websites on Azure Storage
Creating a Static Website
Navigate to your storage account
Select Static Website from the blade and toggle to "enabled"
Once you save, this will create a URL endpoint and also a bucket named $web to host your files
Go to your $web storage container and upload any files you want
Add CDN / Custom Domain
Navigate to your CDN Profile and either Create / Edit your Endpoint
Select 'Custom Origin' and use the 'Origin Hostname' that was created for your static site
Give Azure up to 30 minutes to propagate all the settings
Further Reading
Tutorial: Host a static website on Blob Storage
Tutorial: Use Azure CDN to enable a custom domain with SSL for a static website

Azure Static Website Hosting

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

Azure CDN default document index.html

I have now successfully setup my static website in a CDN,
Is there a way to specify that index.html is the default document ?
It is a 1 page site I just would like to browse to the root url without having to type /index.html ..
Thank you
Based on your previous question, I am assuming that you have set CDN to map to blob storage. If this is correct, unfortunately it is not possible as of today because Azure Storage does not have a support for default document. This is one of the most requested feature on Azure Feedback - https://feedback.azure.com/forums/217298-storage/suggestions/1180039-support-a-default-blob-for-blob-storage-containers however it is still pending.
If you want, you can create a proper website (instead of having this index.html file in blob storage) and serve that website via CDN. You can find more details about it here: https://azure.microsoft.com/en-in/documentation/articles/cdn-websites-with-cdn/.
Microsoft is working on this. At the moment you have only two possibilities to solve this:
Use CDN: With the premium version of Verizon you can create rules like Redirect Rules
Create an Web-App which act as a proxy and serves/redirects (to) blobs
Using Premium CDN
If you purchased the premium version of Verizon CDN then you can create custom Rewrite rules. You'll find this in the "Advanced Features" section of your CDN endpoint. Once you click on "Manage" you will be redirected outside the portal where you can manage your cdn.
Hier you must create a redirect rule like this:
Note that each change in a rule takes about 5 hours to be activated.
To check if your redirect rule works you can install IIS and activate the URL Rewrite Module. In the Rewrite Module you can test your rules.
Open IIS
Open Url Rewrite Module
Add Rule
Add blank rule
Test Pattern
Please note that if you test your pattern, it must begin with the CDN source path which is a number and your endpointname like /829292/movies.
Sometimes redirect rules causes problems with CDN Purging. You can solve this isssue by adding an if clause in your rule which says that redirect should only be active if it is not the purge agent.
This is now possible with Static websites on Azure Storage
Creating a Static Website
Navigate to your storage account
Select Static Website from the blade and toggle to "enabled"
Once you save, this will create a URL endpoint and also a bucket named $web to host your files
Go to your $web storage container and upload any files you want
Add CDN / Custom Domain
Navigate to your CDN Profile and either Create / Edit your Endpoint
Select 'Custom Origin' and use the 'Origin Hostname' that was created for your static site
Give Azure up to 30 minutes to propagate all the settings
Further Reading
Tutorial: Host a static website on Blob Storage
Tutorial: Use Azure CDN to enable a custom domain with SSL for a static website

Resources