🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

flask-ssl

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flask-ssl

Flask SSL require and redirect helper decorator

0.0.0.1rc1
PyPI
Maintainers
1

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.

This software is developed inside Standart AG, LLC, 2019

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts