1

Django converts custom headers per the Django docs:

With the exception of CONTENT_LENGTH and CONTENT_TYPE, as given above, any HTTP headers in the request are converted to META keys by converting all characters to uppercase, replacing any hyphens with underscores and adding an HTTP_ prefix to the name. So, for example, a header called X-Bender would be mapped to the META key HTTP_X_BENDER.

This works as expected on my development (Django Runserver + SQLite) instance. On my staging and production instance (Apache + MySQL), Django also replaces any periods (.) with underscores. Thus, com.example.api.token becomes HTTP_COM.EXAMPLE.API.TOKEN on my development instance. On my staging and production instance com.example.api.token becomes HTTP_COM_EXAMPLE_API_TOKEN.

Why the difference?

4

0 回答 0