Azure App Service - Options Method (and other HTTPS Verb) disabled / not working in Azure Web App
A customer deployed a SignalR API to WebApp. For this particular customer their environment is hosted on Azure App Service using App Service Environment v2. That said, I have reproduced the following behavior on the regular Windows-IIS based Azure Web App.
This SignalR API worked great on local machine, local dev server, and even Azure VM. However when deployed to Azure Web App, one of the API URIs wasn't responding as it should, as developer depends on some return parameters through HTTP Options method, we need to make this work.
When working as intended, using Postman, we should be seeing the following respond
Note that in the example above we are calling the Http verb - Options, basically exposing to the clients what options are available from the service; in this case "WebSockets", "ServerSentEvents", and "LongPolling".
As the application was uploaded to Azure App Service as an API, calling it from Postman, gave us this error message: "the resource you are looking for has been removed, had its name changed, or is temporarily unavailable - HTTP 401". Since this is not 404 error, we are quite sure the resource we are looking for is there, but not responding to our HTTP request.
After some digging around, it turns out that on Azure Web App, Options method is being disabled by default. We eventually added the following lines in one of our Web.config files to allow it.
<configuration> <system.webServer <security> <requestFiltering> <verbs allowUnlisted="true"> <add verb="OPTIONS" allowed="true" /> </verbs> </requestFiltering> </security> </system.webServer> </configuration>
Unfortunately, I wasn't able to find any official documentation on this behavior, and if you do please let me know at the comment section!