Hello.
I am serving my app using apache, supporting both http and https. I am
using authkit for login, and in the login screen generating function,
I am trying to redirect to a https connection if the page is accessed
via plain http.
My function looks like this:
def make_login_page():
# ensure that we serve only https
if request.scheme != 'https':
h.redirect_to(h.url_for('cust_home', request))
return render('/login.mako')
The call to url_for correctly generates the url, however, the server
generates this error (http status 500):
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] mod_wsgi
(pid=4871): Exception occurred within WSGI script '/var/www/b2b.wsgi'.
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/translogger.py",
line 67, in __call__
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] return
self.application(environ, replacement_start_response)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/cascade.py", line
92, in __call__
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] return
self.apps[-1](environ, start_response)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/registry.py", line
340, in __call__
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] app_iter =
self.application(environ, start_response)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/recursive.py",
line 80, in __call__
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] return
self.application(environ, start_response)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/errordocument.py",
line 185, in __call__
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] app_iter =
self.application(environ, change_response)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/authkit/authenticate/
__init__.py", line 290, in __call__
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] return
self.app(environ, start_response)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/authkit/authenticate/
cookie.py", line 352, in __call__
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] return
self.app(environ, cookie_setting_start_response)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/authkit/authenticate/
multi.py", line 67, in __call__
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] result =
check()
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/authkit/authenticate/
multi.py", line 59, in check
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] return
binding(environ, logging_start_response)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/authkit/authenticate/
form.py", line 81, in __call__
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] content =
self.template() % action
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/var/www/
b2b/b2b/lib/cust_db.py", line 70, in make_login_page
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1]
h.redirect_to(h.url_for('cust_home', request))
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/Routes-1.7.1-py2.5.egg/routes/util.py", line
221, in redirect_to
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] return
config.redirect(target)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] File "/usr/lib/
python2.5/site-packages/Pylons-0.9.6.1-py2.5.egg/pylons/wsgiapp.py",
line 67, in redirect_to
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] raise
httpexceptions.HTTPFound(url)
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] HTTPFound: 302
Found
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1] The resource was
found at
[Mon Nov 10 16:29:12 2008] [error] [client 127.0.0.1]
https://localhost/cust_home
Any help on how to make authkit handle the redirect is greatly
appreciated!
thanks,
Vijay
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---