{"id":13421645,"url":"https://github.com/kennethreitz/flask-sslify","last_synced_at":"2025-12-30T05:12:32.867Z","repository":{"id":57430772,"uuid":"185193259","full_name":"kennethreitz/flask-sslify","owner":"kennethreitz","description":"Force SSL on your Flask app. ","archived":false,"fork":true,"pushed_at":"2022-09-15T20:19:59.000Z","size":39,"stargazers_count":28,"open_issues_count":1,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-14T22:17:11.872Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/Flask-SSLify","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"not-kennethreitz/flask-sslify","license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kennethreitz.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-06T12:34:26.000Z","updated_at":"2024-07-31T09:55:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kennethreitz/flask-sslify","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethreitz%2Fflask-sslify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethreitz%2Fflask-sslify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethreitz%2Fflask-sslify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethreitz%2Fflask-sslify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kennethreitz","download_url":"https://codeload.github.com/kennethreitz/flask-sslify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243718914,"owners_count":20336590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T23:00:27.612Z","updated_at":"2025-12-18T10:29:51.362Z","avatar_url":"https://github.com/kennethreitz.png","language":"Python","readme":"Flask-SSLify\n============\n\nThis is a simple Flask extension that configures your Flask application to redirect\nall incoming requests to HTTPS.\n\nThe extension is no longer maintained, prefer using `Flask-Talisman \u003chttps://github.com/GoogleCloudPlatform/flask-talisman\u003e`_ as it is encouraged by the `Flask Security Guide \u003chttp://flask.pocoo.org/docs/dev/security/\u003e`_.\n\nIf you're interested in financially supporting Kenneth Reitz open source, consider `visiting this link \u003chttps://cash.me/$KennethReitz\u003e`_. Your support helps tremendously with sustainability of motivation, as Open Source is no longer part of my day job.\n\nRedirects only occur when ``app.debug`` is ``False``.\n\nUsage\n-----\n\nUsage is pretty simple::\n\n    from flask import Flask\n    from flask_sslify import SSLify\n\n    app = Flask(__name__)\n    sslify = SSLify(app)\n\n\nIf you make an HTTP request, it will automatically redirect::\n\n    $ curl -I http://secure-samurai.herokuapp.com/\n    HTTP/1.1 302 FOUND\n    Content-length: 281\n    Content-Type: text/html; charset=utf-8\n    Date: Sun, 29 Apr 2012 21:39:36 GMT\n    Location: https://secure-samurai.herokuapp.com/\n    Server: gunicorn/0.14.2\n    Strict-Transport-Security: max-age=31536000\n    Connection: keep-alive\n\n\nHTTP Strict Transport Security\n------------------------------\n\nFlask-SSLify also provides your application with an HSTS policy.\n\nBy default, HSTS is set for *one year* (31536000 seconds).\n\nYou can change the duration by passing the ``age`` parameter::\n\n    sslify = SSLify(app, age=300)\n\nIf you'd like to include subdomains in your HSTS policy, set the ``subdomains`` parameter::\n\n    sslify = SSLify(app, subdomains=True)\n\n\nOr by including ``SSLIFY_SUBDOMAINS`` in your app's config.\n\n\nHTTP 301 Redirects\n------------------\n\nBy default, the redirect is issued with a HTTP 302 response. You can change that to a HTTP 301 response\nby passing the ``permanent`` parameter::\n\n    sslify = SSLify(app, permanent=True)\n\nOr by including ``SSLIFY_PERMANENT`` in your app's config.\n\n\nExclude Certain Paths from Being Redirected\n-------------------------------------------\nYou can exlude a path that starts with given string by including a list called ``skips``::\n \n     sslify = SSLify(app, skips=['mypath', 'anotherpath'])\n\nOr by including ``SSLIFY_SKIPS`` in your app's config.\n\n\nInstall\n-------\n\nInstallation is simple too::\n\n    $ pip install Flask-SSLify\n    \n    \nSecurity consideration using basic auth\n---------------------------------------\n\nWhen using basic auth, it is important that the redirect occurs before the user is prompted for\ncredentials. Flask-SSLify registers a ``before_request`` handler, to make sure this handler gets\nexecuted before credentials are entered it is advisable to not prompt for any authentication\ninside a ``before_request`` handler.\n\nThe example found at http://flask.pocoo.org/snippets/8/ works nicely, as the view function's\ndecorator will never have an effect before the ``before_request`` hooks are executed.\n","funding_links":[],"categories":["Frontend","Python","介绍","Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennethreitz%2Fflask-sslify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkennethreitz%2Fflask-sslify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennethreitz%2Fflask-sslify/lists"}