Skip to content

Commit 1be8653

Browse files
authored
Remove empty origins for array version of CORS domains too (#2210)
1 parent f00d36d commit 1be8653

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

infra/main.bicep

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,8 @@ var msftAllowedOrigins = [ 'https://portal.azure.com', 'https://ms.portal.azure.
256256
var loginEndpoint = environment().authentication.loginEndpoint
257257
var loginEndpointFixed = lastIndexOf(loginEndpoint, '/') == length(loginEndpoint) - 1 ? substring(loginEndpoint, 0, length(loginEndpoint) - 1) : loginEndpoint
258258
var allMsftAllowedOrigins = !(empty(clientAppId)) ? union(msftAllowedOrigins, [ loginEndpointFixed ]) : msftAllowedOrigins
259-
var allowedOrigins = union(split(allowedOrigin, ';'), allMsftAllowedOrigins)
260-
// Filter out any empty origin strings and remove any duplicate origins
261-
var allowedOriginsEnv = join(reduce(filter(allowedOrigins, o => length(trim(o)) > 0), [], (cur, next) => union(cur, [next])), ';')
259+
// Combine custom origins with Microsoft origins, remove any empty origin strings and remove any duplicate origins
260+
var allowedOrigins = reduce(filter(union(split(allowedOrigin, ';'), allMsftAllowedOrigins), o => length(trim(o)) > 0), [], (cur, next) => union(cur, [next]))
262261

263262
// Organize resources in a resource group
264263
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
@@ -393,7 +392,7 @@ var appEnvVariables = {
393392
AZURE_AUTH_TENANT_ID: tenantIdForAuth
394393
AZURE_AUTHENTICATION_ISSUER_URI: authenticationIssuerUri
395394
// CORS support, for frontends on other hosts
396-
ALLOWED_ORIGIN: allowedOriginsEnv
395+
ALLOWED_ORIGIN: join(allowedOrigins, ';')
397396
USE_VECTORS: useVectors
398397
USE_GPT4V: useGPT4V
399398
USE_USER_UPLOAD: useUserUpload

0 commit comments

Comments
 (0)