not-kennethreitz / flask-sslify

Force SSL on your Flask app.
https://pypi.python.org/pypi/Flask-SSLify
BSD 2-Clause "Simplified" License
504 stars 85 forks source link

Exceptions for permissible HTTP situations #25

Closed quietlyconfident closed 9 years ago

quietlyconfident commented 10 years ago

Currently, SSLify watches DEBUG to see if it should SSLify or not a request. However, it would be useful to be able to provide a more advanced criteria for per-request SSLification.

For example, using SSLify on Amazon Elastic Beanstalk, SSLify keeps trying to redirect the health checker, which results in failing checks. It would be nice to be able to add a "criteria" to the list of criteria in redirect_to_ssl, so that you could check to see if, for example, the user agent was the ELB Health Checker and the requested URL was the URL to be tested. Or even, just to exclude a URL from the SSLification.

If the maintainer would be open to such a patch, I'll submit it.

bruce-lyft commented 10 years ago

+1 Just ran into this same issue, with AWS ELB's. CF:

https://github.com/kennethreitz/flask-sslify/pull/26

ryan-lane commented 9 years ago

+1 Also would like to be able to exclude healthcheck urls.

tofias commented 9 years ago

I'm having a hell of a time trying to use nginx as a reverse proxy for a portion of an app and I'd love to be able to exclude a blueprint (or a list of blueprints) from redirection.

quietlyconfident commented 9 years ago

Sorry to be a party pooper; I'm no longer using flask ATM, so I'm not going to be writing the patch :) But I still think it would be a good idea if someone else would do it.

ryan-lane commented 9 years ago

Assuming a PR will be merged to make this possible, I'd be happy to write the patch. I just need to know it's going to get merged. I can make it a bit more generic than #26, as well.

tofias commented 9 years ago

I wrote one over the weekend. I guess I should share.

tofias commented 9 years ago

Okay. I made my first pull request on Github. Who buys the beer? https://github.com/kennethreitz/flask-sslify/pull/28

ryan-lane commented 9 years ago

If it gets merged I'll buy you one, whenever you're in SF. ;)

ryan-lane commented 9 years ago

Resolved via #28