django-heroism icon indicating copy to clipboard operation
django-heroism copied to clipboard

To improve is_secure()

Open martinsam opened this issue 15 years ago • 0 comments

With nginx/gunicorn

My own middleware contains :

    if request.META.get('HTTP_X_URL_SCHEME') == "https" or request.META['HTTP_X_FORWARDED_PROTOCOL'] == 'https':
        request.is_secure = lambda: True
    else:
        request.is_secure = lambda: False

martinsam avatar Dec 20 '10 16:12 martinsam