Il 2014-02-13 06:16 zhenwu he ha scritto:
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.

I'm guessing you have already setup your Django app behind a webserver (Apache, nginx + uwsgi, whatever). I'm also assuming you have already set up an HTTPS virtualhost in your webserver to serve at least your REST API urls.

If I understand correctly, you want to avoid API access using standard HTTP. So what you can do is, when accessing any webservice URL, redirect the request via HTTP 301 to the equivalent HTTPS url.

With nginx you can easily do this in your HTTP virtualhost configuration with something like

...

        location /your-REST-URL-endpoint {
                rewrite ^(.*) https://www.example.com$1 permanent;
        }

...

ciao

Luca

--
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/f19022d28180c5aafa0157b6688753b6%40mail.fantacast.it.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to