Azure / Azure/static-web-apps

Unauthorized response when calling an API Managament Backend API that uses a non-default Subscription Header Name

Open
#1,483 0 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

**To Reproduce**
Steps to reproduce the behavior:
1. Create an API within API Managment
2. Change the API's Subscription Header name from `Ocp-Apim-Subscription-Key` to `x-api-key`
3. Create a Static Web App and configure API Management as a linked backend
4. [Configure the API Managment API to recieve requests](https://learn.microsoft.com/en-us/azure/static-web-apps/apis-api-management#configure-apis-to-receive-requests) for the above API

**Expected behavior**
Requests made by the Static Web App to the API Management API _should_ include the correct Subscription key value within the the correct Subscription Header for the API.

**Additional context**
I haven't seen any documentation around how/if this is expected to work; there's nothing in the SWA API Managment documentation that suggests such a configuration is _not_ possible.

Having enabled API Management's tracing, I can see that the default `Ocp-Apim-Subscription-Key` appears to be sent from the Static Web App in this configuration, which obviously fails as this is not the correct Subscription Header for the API.

In my specific setup, I have a number of _other_ APIs already using `x-api-key` and I require the API design to be consistant.

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.