sruupl / batflat

Lightweight, fast and easy CMS for free. Bootstrap ready. https://batflat.org
MIT License
135 stars 54 forks source link

Add support to HTTPS -> HTTP proxying (i.e. Cloudflare SSL) #79

Closed renatofrota closed 4 years ago

renatofrota commented 4 years ago

Fixes #76

Cloudflare does not pass X-Forwarded-Port header but X-Forwarded-Proto only.

When this header it is set https and you have Flexible SSL enabled it means the request was forwarded from https (visitor -> Cloudflare) to http (Cloudflare -> origin) - i.e.: the forwarded proto is https.

We should pretend the request was received through https locally as well (although it came over http on port 80) or all assets using template vars will be "broken" (using http:// protocol instead https:// as observed on visitor's end).

Documentation is here.

michu2k commented 4 years ago

Thanks @renatofrota