SSLRedirectMiddleware would not solve that problem, all it does is redirect
to https.

The way I handle this is having a line like ` return 301
https://$host$request_uri;
` in my server block listening on port 80, and another server block
listening on port 443 that actually proxies to django.

On Thu, Oct 13, 2016 at 11:18 AM, Akhlaq Rao <[email protected]> wrote:

> Hi Ryne,
>
> I totally get it, but if I do not use SSLRedirectMiddleware then I don't
> see SSL Enable form in the Admin Settings. Do you know how do I enable SSL
> without using SSLRedirectMiddleware? if I go to my frontend nginx all the
> SSL related entries are commented out.
>
> server {
>
>     listen 80;
>     # listen 443 ssl;
>     server_name shop.couture92.com shop.couture92.com.;
>     client_max_body_size 10M;
>     keepalive_timeout    15;
>     error_log /home/admin/logs/couture92_error_nginx.log info;
>
>     # ssl_certificate      conf/couture92.crt;
>     # ssl_certificate_key  conf/couture92.key;
>     # ssl_session_cache    shared:SSL:10m;
>     # ssl_session_timeout  10m;
>
>
> Thanks, your help much appreciated.
>
>
>
> On Thu, Oct 13, 2016 10:44 AM, Ryne Everett [email protected] wrote:
>
>> Whoops. I just pushed a fix for that bug.
>>
>> However, you still shouldn't be using that middleware. If you're going to
>> use an SSL middleware, use django's (https://docs.djangoproject.
>> com/en/1.10/ref/middleware/#module-django.middleware.security). However,
>> my recommendation is to handle the redirect in the frontend server (nginx,
>> apache, etc) instead.
>>
>> On Thu, Oct 13, 2016 at 12:55 AM, Akhlaq Rao <[email protected]>
>> wrote:
>>
>> If it's deprecated then how do we enable SSL now? when I enable it I get
>> the following error:
>>
>> unhandled exception in thread started by <function
>> check_errors.<locals>.wrapper at 0x10ff97950>
>> Traceback (most recent call last):
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/django/utils/autoreload.py",
>> line 226, in wrapper
>>     fn(*args, **kwargs)
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/mezzanine/core/
>> management/commands/runserver.py", line 163, in inner_run
>>     super(Command, self).inner_run(*args, **kwargs)
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/django/core/
>> management/commands/runserver.py", line 142, in inner_run
>>     handler = self.get_handler(*args, **options)
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/mezzanine/core/
>> management/commands/runserver.py", line 166, in get_handler
>>     handler = super(Command, self).get_handler(*args, **options)
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/django/contrib/
>> staticfiles/management/commands/runserver.py", line 27, in get_handler
>>     handler = super(Command, self).get_handler(*args, **options)
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/django/core/
>> management/commands/runserver.py", line 64, in get_handler
>>     return get_internal_wsgi_application()
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/django/core/servers/basehttp.py",
>> line 46, in get_internal_wsgi_application
>>     return get_wsgi_application()
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/django/core/wsgi.py", line 14,
>> in get_wsgi_application
>>     return WSGIHandler()
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/django/core/handlers/wsgi.py",
>> line 153, in __init__
>>     self.load_middleware()
>>   File "/Users/kashfey/Documents/Kash/Development/Webservice/mezzan
>> ine/couture92/lib/python3.5/site-packages/django/core/handlers/base.py",
>> line 58, in load_middleware
>>     mw_instance = mw_class()
>> TypeError: __init__() missing 1 required positional argument:
>> 'get_response'
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to