Giter Site home page Giter Site logo

django-sslify's Introduction

Hey, I'm Randall!

It's great to meet you. I'm a long-time software developer, speaker, author, and entrepreneur.

Randall's GitHub stats

django-sslify's People

Contributors

bengolder avatar cancan101 avatar cloverchio avatar goldibex avatar hdeshev avatar jacobwegner avatar manelclos avatar marcgibbons avatar randalldegges-okta-2 avatar rdegges avatar return1 avatar sesh avatar snyk-bot avatar thedrow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-sslify's Issues

Thanks for making this!

Hello,

I just wanted to say thank you for making this - it made me very happy today when I was updating a site I maintain, it worked exactly as described, and saved me a lot of swearing at a computer.

๐Ÿฅ‡ ๐Ÿ‘

Unable to render templates

Hi Randall,

I am attempting to use this middleware but am having some issues. I added the middleware to my middleware classes (first in the list), and set my application to DEBUG=False. But I am currently unable to render any templates, or rather keep getting this message:

[27/Mar/2015 18:21:27] code 400, message Bad request syntax ('\x16\x03\x01\x00\xaf\x01\x00\x00\xab\x03\x03U\x15\x9f\xa7\xa1\xaf\xf3\xb5s\x17/i\x96-\xee\xeb\xcb\x11\xc5\xb7\x81\xef\xc8\x9a\xdc\xd4/\xc2\x039\xd6\x96\x00\x00J\x00\xff\xc0$\xc0#\xc0')

I read up on a StackOverflow post saying this is related to HTTPS requests but of course, need HTTPS to work for my Django Web App. Any ideas on how to fix this?

PyPI 0.2.1 release for SSLIFY_DISABLE feature

The latest version of django-sslify on PyPI (0.2) does not contain the changes made in Issue #6 (3 months ago), specifically it does not respect the SSLIFY_DISABLE setting.

The latest code version number appears to be 0.2.1 so just running this should do it.

python setup.py sdist upload

Thanks a bunch!

When debug turned off with nginx receive Infinite 301 Error.

I spent hours trying to debug this.

In Nginx I have port 80 redirecting to port 443. I attempted to turn off debug and I would always got an infinite 301 loop. My fix was to uninstall django-sslify and it worked fine!

Did I do anything wrong?

Test errors

when running tests, I am getting some errors. is it possible to disable the middleware while running tests?

DEBUG default toggle, Django messes with it for tests

My team has just implemented SSLify in our project, however, we faced a little hurdle with our Django tests.

Basically, for now we'll disable the middleware durings tests, because the Django test client makes HTTP requests by default, and we'll need to switch all those calls to HTTPS (e.g. with the secure option added in 1.7).

So why not turn DEBUG at True for the duration of the tests, we thought? From the README:

Disabling SSLify

If you'd like to disable SSLify in certain environments (for local development, or running unit tests), the best way to do it is to modify your settings file and add the following:
SSLIFY_DISABLE = True

Note
django-sslify is automatically disabled if settings.DEBUG is True.

Well, that was a bad idea, because we didn't know this (and was painful to discover):

Regardless of the value of the DEBUG setting in your configuration file, all Django tests run with DEBUG=False. This is to ensure that the observed output of your code matches what will be seen in a production setting.

https://docs.djangoproject.com/en/1.6/topics/testing/overview/#other-test-conditions (also valid for 1.7, 1.8)

Bottom line is, recommending SSLIFY_DISABLE is definitely correct, but maybe it would be worth adding a little warning regarding that behavior of Django with DEBUG?
It might even make sense to drop the support for DEBUG in the light of this.

django-sslify Usage with Cloudflare

Apologies in advance if this isn't the appropriate place to note the following.

When using django-sslify with an app behind Cloudflare, you have to have the Cloudflare SSL option set to "Full SSL" (or possibly "Off", but I'm unable to test that).

Screenshot_3_6_13_7_44_AM

This is because if you have the Cloudflare SSL option set to "Flexible", even if the user specifies an HTTPS connection, Cloudflare will then connect to your app without SSL (see image above) and HTTP_X_FORWARDED_PROTO will be set to http. This will cause an infinite redirect loop as django-sslify attempts to redirect the connection to HTTPS - starting the whole loop over again.

Whether this is worth noting in the README or better to close this issue as a record for others to find via google, I'll leave to you @rdegges ๐Ÿ˜ƒ

New release

Hi Randall!

Would there be any chance of rolling a release? The PR merged in #35 a year or so ago is now needed for Django 2.0, and isn't in a released version on PyPI.

Thanks!
Marc

Can't run server, getting an error `SSLifyMiddleware() takes no arguments`

Problem: can't run local server.
Command python manage.py runserver fails with following error:

...
mw_instance = middleware(handler)
TypeError: SSLifyMiddleware() takes no arguments

I've installed django-sslify using pipenv install django-sslify command.
Current requrements.txt contents below:

Django==2.0.7
django-sslify==0.2.7
pytz==2018.5

Then made following changes at my settings.py:

SECURE_SSL_REDIRECT = True

INSTALLED_APPS = [
    'sslify',
     '...',
 ]

MIDDLEWARE = [
      'sslify.middleware.SSLifyMiddleware',
     '...',
 ]

Probably I missed some small detail. Will appreciate if someone point where to.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.