On Dec 16, 2009, at 6:58 PM, Álvaro Justen [Turicas] wrote:

> On Thu, Dec 10, 2009 at 20:50, mdipierro <mdipie...@cs.depaul.edu> wrote:
>> I would suggest creating a model 0_redefine_url.py that contains:
>> 
>> _URL=URL
>> def URL(*a,**b):
>>   if not 'secure' in b:
>>       return _URL(*a,**b)
>>   elif b['secure']:
>>       del b['secure']
>>       return 'https://'+request.env.http_host + _URL(*a,**b)
>>   else:
>>       del b['secure']
>>       return 'http://'+request.env.http_host + _URL(*a,**b)
>> 
>> and use URL(....,secure=True), URL(...secure=False) as required
> 
> I think this is very useful. Can we add this in trunk?

It *would* be useful, I think. If URL() defaults secure=None ...

> 
>> Massimo
>> 
>> 'https://'+request.env.http_host +'/app/default/logon')
>> 
>> On Dec 10, 2:11 pm, Wes James <compte...@gmail.com> wrote:
>>> Actually, I don't think it would matter if there were a proxy or not??
>>> 
>>> On Thu, Dec 10, 2009 at 1:06 PM, Wes James <compte...@gmail.com> wrote:
>>>> As long as you don't have a proxy between your users and the server
>>>> something with request.env could be used
>>> 
>>>> def login():
>>>>    if request.env.port != 443:
>>>>       redirect('https://'+request.env.http_host +'/app/default/logon')
>>> 
>>>> -wes
>>> 
>>>> On Thu, Dec 10, 2009 at 11:42 AM, Jay <j...@unclehenrys.com> wrote:
>>>>>  I am new to web2py and Apache w/mod_ssl and I have been searching
>>>>> for
>>>>>  a solution related to this topic but I must be missing a basic
>>>>>  understanding of the necessary pieces in order to accomplish this.
>>> 
>>>>>  Our web2py apache setup seems to be fine.  I can access our app's
>>>>>  pages using both http and https if I manually add the 's' to the url.
>>> 
>>>>>  What we are trying to do is smoothly transition from one controller/
>>>>>  function using http to another using https.
>>>>>  Example, a user arrives athttp://init/default/indexand then the
>>>>> user
>>>>>  selects ‘Login’ and they are sent to https:/init/default/login.  We
>>>>>  need some controller functions to use http and some https.  Can this
>>>>>  be done from within the controller/function?  If not, what is the
>>>>>  ‘best practice’ approach to accomplishing this?
>>> 
>>>>>  - Jay
>>> 
>>>>> --


--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to