Hi mugi112,
Welcome to the Microsoft Q&A.
I understand that you're experiencing difficulties with authorization header when acting as a reverse proxy
To fix the issue, Lets follow these steps:
- Use an Azure Web App setting to preserve the Authorization header: az webapp config appsettings set --resource-group <your-resource-group> --name <your-app-name> --settings "WEBSITES_DISABLE_APP_SERVICE_AUTHENTICATION=True" OR manually add an App Setting in the Azure Portal: Go to Azure Portal → Your App Service → Configuration → Application Settings Add: WEBSITES_DISABLE_APP_SERVICE_AUTHENTICATION = True
- Modify NGINX to Pass the Authorization Header:- Ensure that NGINX is explicitly passing the Authorization header: proxy_set_header Authorization $http_authorization; Also, check if proxy_pass_request_headers is enabled.
- Ensure Web App Doesn’t Require Authentication:- If you are using Azure App Service Authentication (Easy Auth), it might interfere. Disable authentication in Azure Portal under: App Service → Authentication / Authorization then Set "App Service Authentication" to Off (or adjust settings as needed).
- Debug with Kudu Console:- You can check incoming headers using Kudu Console: Navigate to Kudu Console. Use curl to inspect headers: Check if the Authorization header is being received. curl -I -H "Authorization: Bearer test-token" https://<your-app-name>.azurewebsites.net/.
For reference - https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal#preserve-the-authorization-header
If you have any further assistant, do let me know.