I created a Node.js based web application, running in an Azure Web App, that I wanted to put behind an Azure Active Directory authentication. After activating "App Service Authentication", the login process works normally, however upon returning to my app, it just returns a HTTP 431 "Request Header Fields Too Large".
To validate it's not my app, I checked the Azure web app sample for Node.js and even this returns a 431 when activating AAD.
Steps to reproduce:
- Create new Azure resource -> Web App
- Select any Node based runtime stack, for example Node 12 LTS
- Select any OS
- Create the web app and wait for deployment to finish
- Create a simple web app
- Example: https://github.com/Azure-Samples/app-service-web-nodejs-get-started
- Deploy on the web service
- Result so far: App works.
- In the web app settings, go to "Authentication / Authorization"
- Turn "App Service Authentication" to "On"
- Select Azure Active Directory
- Select Express Management Mode and create a new Azure AD App in the process
- As "Action to take when request is not authenticated" select "Log in with Azure AD"
- Confirm
Result: When opening the web app URL with a browser, it will show the log in process, following the process everything seems to work fine and the AAD returns to the application, however at that point it returns a HTTP 431.
Further tests:
- Deactivate the authentication and everything works fine again
- Upload a simple .html file instead of a Node app works fine with authentication enabled
- Tested with restify and http
Any ideas? Am I missing something?