HTTP 431s on Azure App Services - Linux
This blog quickly describes about the status code HTTP 431 and how we can address it on Azure App Services - Linux
For Applications that run on Azure App Services - Linux platform with Authentication (Easy Auth) enabled, an additional container is spawned up. All the requests to the App Service and from the App Service back to the client pass through this middleware container, which basically authenticates the requests and adds certain headers to the request that might cause specific Application Stacks to return a response to the request with the status code - 431 Request Header Fields Too Large.
A common example is a Node Application returning this status code for a request when easy auth is enabled for the Azure App Service. The max header size for Node till Nodejs 12 was 8 KB and generally the total header size after enabling auth increases beyond the maximum size.
The most quickest way to address this behavior is to add the following App Setting to our concerned App Service
The Application setting basically removes the identity header which is a significantly large header and decrease the overall size of the headers for the requests. More information about this App Setting is mentioned in this article
Hope this helps to address similar issues.