Hello @Hao Li
It appears that you’re encountering an HTTP 431 error related to “Request Header Fields Too Large” in your Azure App Service. Let’s try this.
The 431 error occurs because more recent versions of Node.js have a hard cap of 8KB for headers. When you enable “App Service Authentication,” EasyAuth adds large headers to the request, which can cause the Node.js container to reject it. Here’s how you can mitigate this:
- Disable Identity Flow:
- Set the app setting
WEBSITE_AUTH_DISABLE_IDENTITY_FLOW
totrue
. This removes one of the largest headers added by EasyAuth. Note that this header is generally used by .NET Framework and Azure Functions apps, so it should be safe to disable. - You can configure this in your Azure Web App’s Application Settings.
- Set the app setting
- Node.js Version:
- If the issue persists, consider using Node.js 12 versions, as they might handle headers differently.
- Increase Header Size Parameter:
- You can also try increasing the header size parameter by running your Node.js server with the following command:
node server.js --max-http-header-size 81000
- Adjust the value as needed.
Remember to apply these changes to your affected Azure Web App instances. and restart the app service.
I hope that this response has addressed your query and helped you overcome your challenges. If so, please mark this response as Answered. This will not only acknowledge our efforts, but also assist other community members who may be looking for similar solutions.