Azure / Azure/static-web-apps

Front Door + APIM Backend 500 Error

Open
#930 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Using my SWA behind a standard tier Front Door and I am running into the following 500 error when I am sending out requests with my linked **APIM** backend.

For example when I send the following **GET** request `api/surveys/workplace/all` from the `/hello` route

I am receiving the following in response:

Screen Shot 2022-09-23 at 3 15 05 PM

Below is my configuration using custom B2C Auth:

```json
{
"auth": {
"identityProviders": {
"customOpenIdConnectProviders": {
"b2cAS": {
"registration": {
"clientIdSettingName": "AS_AD_CLIENT_ID",
"clientCredential": {
"clientSecretSettingName": "AS_AD_CLIENT_SECRET"
},
"openIdConnectConfiguration": {
"wellKnownOpenIdConfiguration": "https://as.auth.surveys.halotrade.net/9bc029c2-3751-47f7-964d-08917ee570af/B2C_1A_username_susi/v2.0/.well-known/openid-configuration"
}
},
"login": {
"nameClaimType": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
"scopes": ["openid", "profile"]
}
},
"b2cEU": {
"registration": {
"clientIdSettingName": "EU_AD_CLIENT_ID",
"clientCredential": {
"clientSecretSettingName": "EU_AD_CLIENT_SECRET"
},
"openIdConnectConfiguration": {
"wellKnownOpenIdConfiguration": "https://eu.auth.surveys.halotrade.net/1c452f9d-5416-4fba-81fa-4991e2e939e3/B2C_1A_username_susi/v2.0/.well-known/openid-configuration"
}
},
"login": {
"nameClaimType": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
"scopes": ["openid", "profile"]
}
}
}
}
},
"routes": [
{
"route": "/",
"allowedRoles": ["authenticated"],
"headers": {
"Cache-Control": "no-store"
}
},

{
"route": "/login",
"allowedRoles": ["anonymous"]
},
{
"route": "/hello",
"allowedRoles": ["authenticated"]
},
{
"route": "/api/*",
"methods": ["GET", "POST"],
"allowedRoles": ["authenticated"]
},
{
"route": "/error",
"allowedRoles": ["authenticated"]
},
{
"route": "/logout",
"redirect": "/.auth/logout"
}
],
"globalHeaders": {
"content-security-policy": "script-src-elem * 'unsafe-inline'; connect-src https://signalr-worker-prod-cnin-001.service.signalr.net wss://signalr-worker-prod-cnin-001.service.signalr.net https://surveys.halotrade.net/ http://localhost:4280/ https://apim-halo-prod-cnin-001.azure-api.net/surveys/negotiate https://apim-halo-prod-westeu-001.azure-api.net/surveys/negotiate https://sthalosurveysprodcnin.blob.core.windows.net https://sthaloprod.blob.core.windows.net https://sthalosurveysprodwesteu.blob.core.windows.net https://apim-halo-prod-westeu-001.azure-api.net/api/surveys/workplace/all;"
},
"navigationFallback": {
"rewrite": "index.html",
"exclude": ["/images/*.{png,jpg,gif}", "/css/*"]
},
"networking": {
"allowedIpRanges": ["AzureFrontDoor.Backend"]
},
"forwardingGateway": {
"requiredHeaders": {
"X-Azure-FDID": "e6e23c4c-2e6c-4dbb-baf5-e5e33535c886"
},
"allowedForwardedHosts": ["surveys.halotrade.net"]
},
"responseOverrides": {
"400": {
"rewrite": "/invalid-invitation-error.html"
},
"401": {
"statusCode": 302,
"redirect": "/login"
},
"403": {
"rewrite": "/custom-forbidden-page.html"
},
"404": {
"redirect": "/login"
}
},
"mimeTypes": {
".json": "text/json"
}
}
```

Maybe there is something I am missing.

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.