Web App URL throws Bad Request Error when opening application for few users .

Shreyas Rastogi 225 Reputation points
2024-01-02T21:41:48.78+00:00

Hi ,

We have a web app in python running on Azure App Service . App URL works fine for users but for few users we are getting below error

Bad Request , Error parsing headers: 'limit request headers fields size .

Is there any setting for headers that needs to be checked or recommended way to increase the header length to avoid this error .

Thanks.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,935 questions
{count} votes

Accepted answer
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2024-01-03T19:33:55.5766667+00:00

    @Shreyas Rastogi , Thanks for posting this question.

    Just to highlight, the “Front Ends” that act as load balancers to the application(s) running behind them have a hard upper limit of 64KB for total request header sizes.

    The Front End configuration is not able to be changed. This means that although the application side can be changed (as discussed below), and depending on the server running the application - may have a various default total header size limit, but in all cases, the upper limit will always only be 64KB in size.

    Python and Linux App Services uses Gunicorn to help run wSGI based applications on Azure. Therefore configuring allowed request header sizes would be done on Gunicorn itself.

    In the Azure Portal go to your App Service and choose Configuration -> General Settings and then add gunicorn --bind 0.0.0.0:8000 --timeout 600 app:app --limit-request-field_size 64000 to the Startup Command field. This example sets allowed header sizes to 64KB.

    Change app:app to reflect your wSGI variable name and file name that contains the wSGI module.

    This general approach using Gunicorn and passing –limit-request-field_size would work for most wSGI applications on Python and App Service Linux.

    Reference: Increasing Request Header sizes on Linux App Services

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.