Julien Danjou 4/25/2018

Correct HTTP scheme in WSGI with Cloudflare

Read Original

This technical article explains a common problem where Cloudflare's Flexible SSL mode causes WSGI applications to incorrectly report the HTTP scheme as 'http' instead of 'https'. It details the issue with headers like X-Forwarded-Proto, discusses limitations with multiple proxies (e.g., Heroku), and provides a Python WSGI middleware solution that uses Cloudflare's Cf-Visitor header to correctly set the wsgi.url_scheme.

Correct HTTP scheme in WSGI with Cloudflare

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

1
The Beautiful Web
Jens Oliver Meiert 2 votes
3
LLM Use in the Python Source Code
Miguel Grinberg 1 votes
4
Wagon’s algorithm in Python
John D. Cook 1 votes