Den 13/02/2014 kl. 06.16 skrev zhenwu he <zhenwu...@gmail.com>:

> 
> Thanks for your help, Luca. 
> 
> Could you elaborate a little bit? I am kind of new to this kind of thing. 
> What I am doing is that, I am using django to redirect all url calls to 
> python API to handle something and then return as response. you want me to 
> redirect this http call to where? and where do I setup this redirect? in 
> django? BTW, I am using manage.py run server 0:xxxx, and it started listening 
> to http port.

runserver doesn't support HTTPS. You need to run a real webserver like Apache 
to start serving HTTPS requests, or at least install stunnel 
(http://stackoverflow.com/questions/8023126/how-can-i-test-https-connections-with-django-as-easily-as-i-can-non-https-connec).

To tell your users that you are now serving everything over HTTPS instead of 
HTTP, tell your webserver to redirect everything. This is for Apache:

<VirtualHost *:80>
    [...]
    ServerName example.com
    RewriteEngine On
    RewriteRule ^/(.*)$ https://example.com/$1 [R=301]
</VirtualHost>


You could also do the redirection in Django by looking at 
HttpRequest.is_secure(), if your redirection logic is more complicated.


Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/E44204D1-218F-4874-ABB3-BDB9860A1F42%40cederstrand.dk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to