SSL Force Middleware
A simple way to force SSL on all pages. It's very simple at this point - the only issue I can see right now and I will address this later is if someone sends http:// in another portion of your url.
- middleware
- django
- ssl
- secure
A simple way to force SSL on all pages. It's very simple at this point - the only issue I can see right now and I will address this later is if someone sends http:// in another portion of your url.
If you request static files such as images, javascript or css using http rather than https, the browser will complain that your site is not secure. This simple context processor will replace http:// with https:// in your MEDIA_URL if your static files are being included from an https page. In your settings.py just replace 'django.core.context_processors.media' with your new context processor.
I couldn't find a Python implementation of this, so I threw this class together real quick. This will let you share "private" files on S3 via a signed request. It will also have an expiration on the link, so it is only valid until a certain time period. Example Usage: s3 = SecureS3('AWS_ACCESS_KEY', 'AWS_SECRET_ACCESS_KEY') s3.get_auth_link('your_bucket', 'your_file') That would return your secure link. eg, http://your_bucket.s3.amazonaws.com/your_file?AWSAccessKeyId=AWS_ACCESS_KEY&Expires=1226198694&Signature=IC5ifWgiuOZ1IcWXRltHoETYP1A%3D
3 snippets posted so far.