parameterized router BASE breaks appadmin redirection

46 views
Skip to first unread message

cowbert

unread,
May 12, 2014, 10:06:56 PM5/12/14
to web...@googlegroups.com
When BASE is specified in a parameterized router, and an unauthenticated session tries to go to the appadmin URL, the admin login controller fails to prepend BASE to the value of the hidden form input element 'send', causing redirection after authentication to redirect to the wrong URL (the one without BASE). The session authentication is successful though, so going to the appadmin URL after this will work.

routes.py is the same as routes.parametric.example.py except that

BASE = '/web2py'

Going to:
https://host/web2py/admin/default/design/welcome

results in a redirection to:

https://host/web2py/admin/default/index?send=%2Fadmin%2Fdefault%2Fdesign%2Fwelcome

when send should really =%2Fweb2py%2Fadmin%2Fdefault%2Fdesign%2Fwelcome

This is on 2.9.5-stable+timestamp.2014.03.16.02.35.39 with firefox 29. The server does use a proxy to do the webserving, but the rewrite rule is just  http[s]*://host/web2py/(.*) -> http://127.0.0.1:8080/$1 and the reverse maps http://127.0.0.1:8080/(.*) back to http(s)://host/web2py/$1

Is this a bug? Or is some setup wrong? (Everything else seems to be working fine)

cowbert

unread,
Jun 19, 2014, 8:51:56 PM6/19/14
to web...@googlegroups.com
Actually ticket URLs are also broken in this way (since it sends to /admin/ticket instead of to BASE + /admin/ticket...

cowbert

unread,
Mar 11, 2015, 6:24:57 AM3/11/15
to web...@googlegroups.com
I am still having issues with this on 2.9.12. Here is my routes.py:

BASE = '/web2py'

routes_in = (
    (BASE + '/$anything', '/$anything'),
)

routes_out = [(x, y) for (y, x) in routes_in]

In this case, if I try to go to an admin url (like /web2py/admin/debug) and I am not logged in as admin, on the user login page, the hidden POST field "send" is set to redirect me to /admin/debug:
<input type="hidden" name="send" value="/admin/debug/"/>

This happens with the Error 500 page and Ticket link generator as well.

 I tried looking in admin's appadmin.py and default.py controllers and could not find why either send=URL('site') or redirect(URL('admin','default','index',vars=dict(send=URL(args=request.args, vars=request.vars)))) is not picking up the correct routing and prepending the rendered URL with my BASE ('/web2py')
Reply all
Reply to author
Forward
0 new messages