#37512 new Uncategorized

Gunicorn now complains about HEAD responses with bodies

Reported by: Kyle Dickerson Owned by:
Component: HTTP handling Version: 6.1
Severity: Low Keywords: HEAD WSGI
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is a boundary issues between Django and Gunicorn resulting from changes in Gunicorn 26.1.0.

Way back in version 1.9, Django dropped its behavior of removing bodies in responses to HEAD requests on the basis that most WSGI servers already did that work. See https://code.djangoproject.com/ticket/26052

Gunicorn 26.1.0 introduced warning logging when the application includes a body in responses to HEAD requests. See ​https://github.com/benoitc/gunicorn/commit/9bc5891b4b06f25a8ce0e707053dcb2fb9bf638c

As a result, logs now get polluted with these warnings. Gunicorn doesn't offer a simple way to control that warning (would need to craft a custom logging configuration to target the warning for exclusion).

As an application owner, Gunicorn is signalling that applications returning bodies to HEAD requests are a "problem to be solved by the application." But Django explicitly removed this behavior because it was redundant with the common WSGI server implementations.

I don't know if either side is more correct than the other, but a conversation between the Django and Gunicorn teams is probably the most effective way to find a user-friendly resolution. Otherwise each project can point the finger back at the other and the user experience will suffer indefinitely.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top