Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW FeatureRequest: AzureFrontDoor redirection configuration #4562

Closed
naikajah opened this issue Oct 8, 2019 · 3 comments · Fixed by #4601
Closed

NEW FeatureRequest: AzureFrontDoor redirection configuration #4562

naikajah opened this issue Oct 8, 2019 · 3 comments · Fixed by #4601

Comments

@naikajah
Copy link
Contributor

naikajah commented Oct 8, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Azure Frontdoor allows redirection configuration to allow redirect http traffic to https via following
https://docs.microsoft.com/en-us/azure/frontdoor/front-door-how-to-redirect-https

However, it seems that currently terraform does not allow redirect configuration to be added in its config. It would be great to add a redirecting_configuration similar to what we have currently in forwarding_configuration

New or Affected Resource(s)

  • azurerm_frontdoor

Potential Terraform Configuration

resource "azurerm_frontdoor" "example" {
  name                                         = "example-FrontDoor"
  location                                     = "${azurerm_resource_group.example.location}"
  resource_group_name                          = "${azurerm_resource_group.example.name}"
  enforce_backend_pools_certificate_name_check = false

  routing_rule {
      name                    = "exampleRoutingRule1"
      accepted_protocols      = ["Http", "Https"]
      patterns_to_match       = ["/*"]
      frontend_endpoints      = ["exampleFrontendEndpoint1"]
      redirecting_configuration {
         redirect_type                = "302"
         redirect_protocol         = "HTTPSOnly"
      }
  }

  backend_pool_load_balancing {
    name = "exampleLoadBalancingSettings1"
  }

  backend_pool_health_probe {
    name = "exampleHealthProbeSetting1"
  }

  backend_pool {
      name            = "exampleBackendBing"
      backend {
          host_header = "www.bing.com"
          address     = "www.bing.com"
          http_port   = 80
          https_port  = 443
      }

      load_balancing_name = "exampleLoadBalancingSettings1"
      health_probe_name   = "exampleHealthProbeSetting1"
  }

  frontend_endpoint {
    name                              = "exampleFrontendEndpoint1"
    host_name                         = "example-FrontDoor.azurefd.net"
    custom_https_provisioning_enabled = false
  }
}

References

  • #0000
@WodansSon
Copy link
Collaborator

This is actually already supported and you can use it now. Looks like I just forgot to add it to the documentation. DOH! 🙃

While I'm fixing the docs if you want to use it here are the attributes for the redirect_configuration block:

redirect_configuration {
  custom_host         = "www.contoso.com"                             # Required
  redirect_protocol   = "HTTPSOnly"                                   # Required : (HTTPOnly|HTTPSOnly|MatchRequest)
  redirect_type       = "Found"                                       # Required : (Moved(301)|Found(302)|TemporaryRedirect(307)|PermanentRedirect(308))
  custom_fragment     = "example-fragment"                            # Optional
  custom_path         = "redirected-path"                             # Optional
  custom_query_string = "&utm_referrer=https%3A%2F%2Fwww.bing.com%2F" # Optional
 }

@naikajah
Copy link
Contributor Author

naikajah commented Oct 11, 2019

@WodansSon thank you for replying

I feel that the custom_host attribute of the configuration should be optional.
Azure console also allows it to be optional with a default value of preserve.

I have created the PR for the same. #4601

@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants