http to https redirect not working static website using CDN

Matt C 21 Reputation points
2022-11-26T19:34:53.62+00:00

Hi there,

I am trying to get a website running for a community organization I manage. Content is in blob storage and I have an Azure CDN, I have built a fair few websites, but this is my first on Azure and to be honest, Possibly my last, This process normally takes me 30 mins... two days later I am at a point I have read every support article and most are quite out of date or don't contain the answer I am looking for,

Everything works on https://

I have a custom domain with externally hosted DNS - I have a Cname record pointing at the Azure endpoint
I have been unable to add the root domain to custom domains in Azure, as It can't find the cname record when I try and add it, I have given up on that part for now due to to other workarounds. I have been able to add the www domain and that is working.

I did put in place a workaround in the dns where I have Cname on the root domain pointing to the www domain, this does seem to route traffic to Azure as I get the error :

<h2>Our services aren't available right now</h2><p>We're working to restore all services as soon as possible. Please check back soon.</p>0JmiCYwAAAACm4omPfniYRYSqg9YHEzkjQUtMMzBFREdFMDMyMQBFZGdl

I have setup some rules in the rules engine to rewrite http request to https - but these don't appear to be working

264443-image.png

I think at this stage I need to enable HTTP in the backend so the rules engine will be able to route the traffic, But despite hundreds of search results, none has lead how to do this.

Thanks!

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,920 questions
Azure Content Delivery Network
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
964 questions
0 comments No comments
{count} votes

Accepted answer
  1. risolis 8,721 Reputation points
    2022-11-27T03:06:20.477+00:00

    Hello @Matt C

    I am happy to know that buddy.

    You can set it up from that menu shown (Allowed IP addresses) as well as from the networking blade as well.

    Moreover, I wonder if you have registered the Microsoft.CDN resource provider at the subscription level and also, check the SKU of your storage account since some options cannot be changed for that reason.

    Looking forward to your feedback,

    Cheers,

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. risolis 8,721 Reputation points
    2022-11-26T21:30:27.733+00:00

    Hello @Matt C

    Thank you for sharing this question on this community space.

    I have gone though the case scenario description and I want to gather the next article so, please direct yourself down below:

    https://learn.microsoft.com/en-us/answers/questions/267935/use-custom-domain-for-azure-cdn-endpoint.html

    I hope you can find this useful to overcome your concern.

    Looking forward to your feedback,

    Cheers,

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

  2. Matt C 21 Reputation points
    2022-11-27T02:32:01.85+00:00

    Thanks Ricardo,
    Great suggestion.
    I have checked and am definitely pointing the cname for my own domain to the CDN endpoint.
    I think I have located the reason, The storage account is set to HTTPS only - but, I can click the radio button to change to HTTP and HTTPS but the issue is I can't see how to save that setting, if you Navigate away from the page, the change does not stay. I am only in the basic stages of the site, so almost wondering If i setup another storage account with http and re-upload the site.

    My CDN tells me I have both HTTP and HTTPS enabled, but the rules for HTTP dont appear to be working and im wondering if its the storage account setting as below
    264454-image.png

    0 comments No comments

  3. Isaac Vergara 0 Reputation points
    2023-09-23T15:37:00.32+00:00

    Good evening everyone,

    I just had the same issue and I realized why I was having this problem.

    If everything works with HTTPS protocol but not with HTTP it could be because on the CDN endpoint configuration you only enabled HTTPS.

    It looks like the delivery rule is not applied because the service blocks the request (due to the invalid protocol) before evaluating the rule.

    If you allow both protocols to access the endpoint and then enforce HTTPS via delivery rule it should work, because the service receives and processes the request and your content will only be delivered via HTTPS.

    Kind regards,

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.