# Azure CDN

## HTTP to HTTPS redirect

CDN endpoint rules engine can be used to redirect HTTP request to HTTPS port.

In Terraform, this can be achieved with the following `delivery_rule` block for `azure_endpoint_resource`:

```
delivery_rule {
    name  = "EnforceHTTPS"
    order = "1"

    request_scheme_condition {
      operator     = "Equal"
      match_values = ["HTTP"]
    }

    url_redirect_action {
      redirect_type = "Found"
      protocol      = "Https"
    }
}
```

Azure docs shows how to do this from Portal <https://docs.microsoft.com/en-us/azure/cdn/cdn-standard-rules-engine#redirect-users-to-https>

## Resources

* Migrating a Static Site to Azure with Terraform - <https://www.emilygorcenski.com/post/migrating-a-static-site-to-azure-with-terraform/>
* Set up the Standard rules engine for Azure CDN - <https://docs.microsoft.com/en-us/azure/cdn/cdn-standard-rules-engine#redirect-users-to-https>&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.tatusl.dev/azure/cdn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
