Skip to main content

Flask SSL require and redirect helper decorator

Project description

Flask SSL require and redirect decorator

Easy to use package for Flask framework to check if request is served securely.

Please note, that this package does not enable SSL directly in Flask app (however we support that) we recommend you to use reverse proxy or wsgi server with configured SSL params.

Install

pip install flask-ssl

Configuration

You should have working reverse proxy server with configured SSL and SSL header information.

This plugin supports nginx and apache default configurations.

For example, for your nginx installation it will be:

server {
  ...

  location  / {
    ...

    proxy_set_header HTTPS on;
    proxy_set_header X-Forwarded-Ssl on;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

Use

from flask_ssl import *

# {...}

@ssl_require
@app.route('/your/url/that/should/be/available/only/with/ssl')
def func():
    return "Ok, served via SSL"

@ssl_redirect
@app.route('/your/url/that/should/be/redirected/to/ssl')
def func2():
    return "Ok, served via SSL"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright

This software is developed inside Standart AG, LLC, 2019

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

flask_ssl-0.0.0.1rc1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file flask_ssl-0.0.0.1rc1-py3-none-any.whl.

File metadata

  • Download URL: flask_ssl-0.0.0.1rc1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for flask_ssl-0.0.0.1rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 89339a368e9b96023cff9e313c4c38110aa36bd80326361aaeb76d9d8c9e6625
MD5 e3daaac71bb65a0ac0e74534fb2f622c
BLAKE2b-256 d1d78e833744bf91bfc235b2c6162bd0ab42c089cdeb732efd9794f06653b6ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page