Hi, Eric:

After thinking further, I am a little lost. :(

Here is my understanding. 

1, I need have django run server running, for example, listen to port 1234
2, I enable https on apache, which is listening to 443. then I redirect all 
connections to 443 to port 1234 using config you provided.

Am I understanding correctly? based on your config, it seems that we are 
trying to redirect any request to port 80 to https, which is different from 
my step 1 and 2.

thanks.

/zhenwu


On Thursday, February 13, 2014 9:58:51 AM UTC-8, zhenwu he wrote:
>
>
> Thanks Eric for your help.
>
> Basically, user has to send REST API to apache using https, and then 
> apache redirect this call to django using http. Should I config anything on 
> django besides configuration redirect on apache. Based on what you are 
> saying, I do not need config anything on django side. thanks.
>
> /zhenwu
>
> On Thursday, February 13, 2014 12:20:51 AM UTC-8, Erik Cederstrand wrote:
>>
>> Den 13/02/2014 kl. 06.16 skrev zhenwu he <zhen...@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/71c69145-f969-4788-8302-dc2af3e67524%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to