diff --git a/infrastructure/templates/public-api/main.bicep b/infrastructure/templates/public-api/main.bicep index a5f687278a5..307d436450f 100644 --- a/infrastructure/templates/public-api/main.bicep +++ b/infrastructure/templates/public-api/main.bicep @@ -475,6 +475,24 @@ module appGatewayModule 'application/shared/appGateway.bicep' = if (deployContai } } } + { + name: 'replace-docs-backend-fqdn-with-public-docs-url' + conditions: [ + { + variable: 'http_resp_Location' + pattern: 'https://${docsModule.outputs.appFqdn}/(.*)' + ignoreCase: true + } + ] + actionSet: { + responseHeaderConfigurations: [ + { + headerName: 'Location' + headerValue: '${publicUrls.publicApi}/docs/{http_resp_Location_1}' + } + ] + } + } ] } ] diff --git a/infrastructure/templates/public-api/types.bicep b/infrastructure/templates/public-api/types.bicep index b579f2a407b..2b3be5af6de 100644 --- a/infrastructure/templates/public-api/types.bicep +++ b/infrastructure/templates/public-api/types.bicep @@ -220,7 +220,10 @@ type AppGatewayRewriteCondition = { @export() type AppGatewayRewriteActionSet = { @description('Rewrite config for the URL') - urlConfiguration: AppGatewayRewriteUrlConfig + urlConfiguration: AppGatewayRewriteUrlConfig? + + @description('Rewrite config for the URL') + responseHeaderConfigurations: AppGatewayRewriteHeaderConfig[]? } @export() @@ -228,13 +231,22 @@ type AppGatewayRewriteUrlConfig = { @description('The path after it has been rewritten. Can contain variables from other parts of the request') modifiedPath: string? - @description('The query string after it has been rewritten. Can contain variables from other parts of the request') + @description('The query string after it has been rewritten. Can contain variables from other parts of the original request') modifiedQueryString: string? @description('Re-evaluate any associated URL path maps with the rewritten path. Defaults to false') reroute: bool? } +@export() +type AppGatewayRewriteHeaderConfig = { + @description('The HTTP header to inspect') + headerName: string + + @description('The header value after it has been rewritten. Can contain variables from other parts of the original header') + headerValue: string +} + // This is not an exhaustive list. For a list of available operators, see: // https://learn.microsoft.com/en-us/azure/templates/microsoft.network/applicationgatewaywebapplicationfirewallpolicies?pivots=deployment-language-bicep#matchcondition type AppGatewayFirewallPolicyCustomRuleOperator =