python - Allow hop-by-hop headers in Django proxy middleware -
i need implement http proxy in django , google safari led me project called django-webproxy.
although no longer maintained, it's quite simple. of logic relies on simple proxy middleware class intercepts requests django wsgi server , handles it.
if middleware returns data, wsgi server passes client if returns nothing, django handles request passing other middleware.
everything works fine, pretty much, need implement proxy authentication mean have send 407 status code client proxy-authenticate
header. sin't allowed django hop-by-hop header , django throws exception. how can hack/force/kludge django allowing me send hop-by-hop headers?
fyi, ihe code middleware class can found here.
from django.core.servers import basehttp del basehttp._hop_headers['proxy-authenticate'] del basehttp._hop_headers['proxy-authorization']
this worked me.
Comments
Post a Comment