Please open a ticket pointing to this. I think we should support something
like this in routes.py but it needs some more thought.
On Sunday, 8 September 2013 00:00:03 UTC-5, Charles Law wrote:
>
> For completeness I have modified code in application:
>
> application_web2py = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
> logfilename=WEB2PY_LOG,
> profilerfilename=None)
>
> def application(environ, start_response):
> fw = environ.get('HTTP_X_FORWARDED_HOST')
> if isinstance(fw, basestring):
> if fw.startswith('rapydscript'):
> if environ['PATH_INFO'] in ['', '/']:
> environ['PATH_INFO'] = '/rapydscript' +
> environ['PATH_INFO']
> elif fw.startswith('rapydml'):
> if environ['PATH_INFO'] in ['', '/']:
> environ['PATH_INFO'] = '/rapydml' + environ['PATH_INFO']
> elif fw.startswith('rapydcss'):
> if environ['PATH_INFO'] in ['', '/']:
> environ['PATH_INFO'] = '/rapydcss' + environ['PATH_INFO']
>
> return application_web2py(environ, start_response)
>
>
>
> On Friday, September 6, 2013 9:01:50 AM UTC-7, Charles Law wrote:
>>
>> We have a site with a subdomain that correctly gets forwarded to web2py
>> on openshift, but the page it hits is our default home page. We want the
>> subdomains to go ti different functions on our default controller, but we
>> can't figure out how to do that with routes. Included below is the current
>> routes file we have. We would like to have visitors going to http(s)://
>> rapydscript.pyjeon.com to visit our rapydscript function on the default
>> controller by default. I tried looking at examples, and what I have below
>> I think should work, but users are just seeing the same content as
>> www.pyjeon.com under the rapydscript subdomain. Is the file setup
>> incorrectly? Does openshift do something odd?
>> Thanks in advance for any help,
>> Charles
>>
>> routes.py:
>>
>> default_application = 'pyjeon' # ordinarily set in base routes.py
>> default_controller = 'default' # ordinarily set in app-specific routes.py
>> default_function = 'index' # ordinarily set in app-specific routes.py
>>
>>
>> BASE = '' # optonal prefix for incoming URLs
>>
>> myapp = 'pyjeon'
>>
>> routes_in = (
>> # reroute favicon and robots, use exable for lack of better choice
>> ('/favicon.ico', '/static/favicon.png'),
>> ('/robots.txt', '/pyjeon/static/robots.txt'),
>> ('/sitemap.xml', '/pyjeon/static/sitemap.xml'),
>> (('.*http://rapydscript.pyjeon.com', '/' + myapp +
>> '/default/rapydscript')),
>> (('.*http://rapydscript.pyjeon.com/(?P<any>.*)', '/' + myapp +
>> '/default/rapydscript/\g<any>')),
>> (BASE + '/', '/' + myapp + '/default/index'),
>> # do not reroute admin unless you want to disable it
>> (BASE + '/admin', '/admin/default/index'),
>> (BASE + '/admin/$anything', '/admin/$anything'),
>> #setup static
>> (BASE + '/static/', '/' + myapp + '/static/index.html'),
>> (BASE + '/static/$anything', '/' + myapp + '/static/$anything'),
>> (BASE + '/appadmin', '/' + myapp + '/appadmin'),
>> (BASE + '/pyjeon/appadmin/$anything', '/' + myapp +
>> '/appadmin/$anything'),
>> (BASE + '/$app/$anything', '/' + myapp + '/default/$app/$anything'),
>> (BASE + '/$app', '/' + myapp + '/default/$app'),
>> # do other stuff
>> # remove the BASE prefix
>> (BASE + '/$anything', '/$anything'),
>> )
>>
>> # routes_out, like routes_in translates URL paths created with the web2py
>> URL()
>> # function in the same manner that route_in translates inbound URL paths.
>> #
>>
>> routes_out = (
>> # do not reroute admin unless you want to disable it
>> ('/admin/$anything', BASE + '/admin/$anything'),
>> # do not reroute appadmin unless you want to disable it
>> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
>> # do not reroute static files
>> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
>> # do other stuff
>> (r'.*http://otherdomain.com.* /app/ctr(?P<any>.*)', r'\g<any>'),
>> (r'/app(?P<any>.*)', r'\g<any>'),
>> # restore the BASE prefix
>> ('/$anything', BASE + '/$anything'),
>> )
>>
>>
>>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.