4👍
✅
The kwargs passed to the credentials()
method ends up feeding directly into the constructor for a WSGIRequest
; this means the kwargs it accepts aren’t HTTP headers, but WSGI environment variables. And HTTP headers passed as WSGI env vars are always prefixed with HTTP_
— e.g. the Authorization
header is configured with HTTP_AUTHORIZATION
. Also, underscores are used in place of dashes.
To have your X-Custom-Header
header come out the other side in request.headers
(not request.META
, which is a copy of the WSGI env vars), pass HTTP_X_CUSTOM_HEADER
instead of X-CUSTOM-HEADER
.
Source:stackexchange.com