Answer the question
In order to leave comments, you need to log in
How to configure apache mod_proxy to skip Authorization header with oauth2 token?
Good afternoon.
Now I'm setting up a service that is hidden behind a server with mod_proxy and there was a problem - mod_proxy removes the "Authorization" header
The service itself is written in django and I wrote a small middleware to output the headers to the logger and then compare them. in total, we have on the dev server:
Although this is probably not a django problem, here is the middleware:
import logging
import re
from django.http import HttpResponseRedirect
logger = logging.getLogger(__name__)
class CurrentMetaMiddleware(object):
def process_request(self, request):
regex = re.compile('^HTTP_')
z = dict((regex.sub('', header), value) for (header, value)
in request.META.items() if header.startswith('HTTP_'))
logger.error(z)
return None
[23/Sep/2014 14:00:32] ERROR [pipelineapi.middleware:14] {'HOST': '127.0.0.1:8000', 'ACCEPT_ENCODING': 'gzip, deflate', 'ACCEPT': '*/*', 'AUTHORIZATION': 'Bearer 9aea813534cb064ab8c6b617c8f23bf68fec3464', 'USER_AGENT': 'python-requests/2.3.0 CPython/2.7.8 Linux/3.14-1-amd64'}
[23/Sep/2014 14:01:52] ERROR [pipelineapi.middleware:14] {'HOST': 'api.some-server.com', 'ACCEPT': '*/*', 'CONNECTION': 'Keep-Alive', 'USER_AGENT': 'python-requests/2.3.0 CPython/2.7.8 Linux/3.14-1-amd64', 'X_FORWARDED_SERVER': ''api.some-server.com', 'X_FORWARDED_HOST': 'api.some-server.com', 'X_FORWARDED_FOR': '192.168.0.18', 'ACCEPT_ENCODING': 'gzip, deflate'}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question