Skip to content

allanlei/django-heroku-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cookbook


Heroku Reverse Proxy

Django behind Heroku's reverse proxy causes request.is_secure() to always return False.

Solutions

  • Add secure_scheme_headers = {'X-FORWARDED-PROTO': 'https'} to Gunicorn's config. See Sample config
  • Add SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO', 'https') in Django settings(development/1.4+). See Django Docs
  • Add heroku.middleware.SecureReverseProxyMiddleware to MIDDLEWARE_CLASSES

Https Requests Only

  1. Apply one of the solutions from Heroku Reverse Proxy
  2. Add heroku.middleware.HttpsRedirectMiddleware to MIDDLEWARE_CLASSES

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages