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
2
Container queries are rad AF!
Chris Ferdinandi 2 votes
3
Wagon’s algorithm in Python
John D. Cook 1 votes
5
Top picks — 2026 January
Paweł Grzybek 1 votes
6
In Praise of –dry-run
Henrik Warne 1 votes
8
Vibe coding your first iOS app
William Denniss 1 votes