mirror of
https://github.com/kennethreitz/flask-sslify.git
synced 2026-06-05 23:00:19 +00:00
39 lines
834 B
ReStructuredText
39 lines
834 B
ReStructuredText
Flask-SSLify
|
|
============
|
|
|
|
This is a simple Flask extension that configures your Flask application to redirect
|
|
all incoming requests to HTTPS.
|
|
|
|
Redirects only occur when ``app.debug`` is ``False``.
|
|
|
|
Usage
|
|
-----
|
|
|
|
Usage is pretty simple::
|
|
|
|
from flask import Flask
|
|
from flask_sslify import SSLify
|
|
|
|
app = Flask(__name__)
|
|
sslify = SSLify(app)
|
|
|
|
|
|
If you make an HTTP request, it will automatically redirect::
|
|
|
|
$ curl -I http://secure-samurai.herokuapp.com/
|
|
HTTP/1.1 302 FOUND
|
|
Server: gunicorn/0.14.2
|
|
Date: Sun, 29 Apr 2012 21:32:00 GMT
|
|
Connection: keep-alive
|
|
Content-Type: text/html; charset=utf-8
|
|
Content-Length: 253
|
|
Location: https://secure-samurai.herokuapp.com/
|
|
Strict-Transport-Security: max-age=31536000
|
|
|
|
|
|
Install
|
|
-------
|
|
|
|
Installation is simple too::
|
|
|
|
$ pip install Flask-SSLify |