Azure Web PubSub HTTP header case sensitivity

Dagfinn Nærheim 0 Reputation points
2025-02-24T13:45:50.3666667+00:00

I have set up an Azure Web PubSub Service that uses event handlers towards a Python FastAPI application hosted as an Azure Container App. When the PubSub service is connecting to the Container App, it first does an OPTIONS request to the "/validate" endpoint. This request expects a response with HTTP header "WebHook-Allowed-Origin". I've noticed that this works fine when using the tunnel service and running the API locally, because the HTTP header name is returned with PascalCase with the exact naming "WebHook-Allowed-Origin".

When hosting this API on Azure as a container app, the header name is returned with lower case as "webhook-allowed-origin". It seems like the PubSub service is very strict on the casing of this header name, as it gives an "AbuseProtectionResponseMissingAllowedOrigin" error when the header name is in lower case.

According to the HTTP specification, header names should be case-insensitive. Why is this an issue for the Web PubSub Service, and is there any way to avoid having the Container App altering the header name casing?

Azure Web PubSub
Azure Web PubSub
An Azure service that provides real-time messaging for web applications using WebSockets and the publish-subscribe pattern.
86 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Alekhya Vaddepally 0 Reputation points Microsoft External Staff
    2025-03-06T14:08:51.86+00:00

    Hi Dagfinn Nærheim,

    It seems like running into an issue Azure web pub sub expects the Webhook-Allowed-Origin header in a specific Pascal Case format, but when you are using FAST API app in hosted on azure container App the header name will convert to lower case. this is because of pub sub service to reject the request with the error "AbuseProtectionResponseMissingAllowedOrigin."

    To avoid this need to configure your FASTAPI applications or web server hosting it, need to ensure that the header is returned with the correct casing and also might need to modify the response header directly in your application code or by configuring the web server settings to preserve the case of the headers.

    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.

    Let me know if you have any further Queries.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.