Reputation: 2083
I have setup my.domain.com/sv
and my.domain.com/en
in Azure Front Door. Now I want to create a rule to redirect from /*
to the correct path depending on Accept-Language
. However, to create a route (that I need to be able to assign the rule to a route) I seem to need an origin group with an origin. Is it possible to create an "empty" route somehow or create the redirect some other way? Or should I just assign google.com
or a dummy value to hostName
to be able to create the route?
My attempt to create a default route using bicep:
resource profile 'Microsoft.Cdn/profiles@2021-06-01' = {
name: profileName
location: 'global'
sku: {
name: skuName
}
}
resource endpoint 'Microsoft.Cdn/profiles/afdEndpoints@2021-06-01' = {
name: 'org-fde-${shortAppName}'
parent: profile
location: 'global'
properties: {
enabledState: 'Enabled'
autoGeneratedDomainNameLabelScope: 'ResourceGroupReuse'
}
}
resource defaultOriginGroup 'Microsoft.Cdn/profiles/originGroups@2021-06-01' = {
name: 'default-origin-group'
parent: profile
properties: {
loadBalancingSettings: {}
}
resource defaultOrigin 'origins' = {
name: 'default-origin'
properties: {
hostName: '/' <-- INVALID
}
}
}
resource defaultRoute 'Microsoft.Cdn/profiles/afdEndpoints/routes@2021-06-01' = {
name: 'default-route'
parent: endpoint
dependsOn:[
defaultOriginGroup::defaultOrigin // This explicit dependency is required to ensure that the origin group is not empty when the route is created.
]
properties: {
originGroup: {
id: defaultOriginGroup.id
}
ruleSets: []
supportedProtocols: [
'Http'
'Https'
]
patternsToMatch: [
'/*'
]
forwardingProtocol: 'HttpsOnly'
linkToDefaultDomain: 'Enabled'
httpsRedirect: 'Enabled'
}
}
Upvotes: 0
Views: 799
Reputation: 1419
As a best practice you should create your origin group with a single origin back to my.domain.com
. That will allow you to create your redirection rule and would make sense to anyone else looking at the configuration.
Upvotes: 1