On Thu, Apr 30, 2009 at 7:14 PM, Octavian Rasnita <[email protected]>wrote:
> *From:* Merlyn Kline <[email protected]> > > > > It could be also helpful if we could find a way to create urls like > > http://user.hostname.com/ > > dynamicly as Google blogger site does. > > We do this with a wildcard A record in the DNS and an Apache URL rewriting > rule that moves the hostname into the path. When I started writing my app > (in Catalytic pre-history) there wasn't any support (that I could see) in > Catalyst for using the hostname in the rules that decide when an action is > invoked and what parameters to pass to it. Things have moved on a lot since > then though so perhaps the URL rewriter could be replaced with a better > action description now. > Merlyn > > > > > If others don't know more about a newer and better way as you suggested, > can you give some hints about the way you told about? > > > > Thanks. > > > > Octavian > > > > I don't see much reason for this to be inside of Catalyst, because the only way to properly test is to stuff the Host: header with the data... that could get a bit weird. Instead, what you can easily do is just setup a rewrite rule in your front-end webserver and translate the path accordingly (this is fairly common). If you did want to do something in Catalyst, you could create a plugin that runs after prepare_path and modifies $c->request->path accordingly (match off $c->req->base domain)... it'd be an interesting plugin, that's for sure. I'm sure some of the deeper Catalyst hackers can think of alternative, and perhaps simpler, ways to do it. I would highly recommend doing it at the webserver level, though... Catalyst's uri_for would generate URIs like ' www.myapp.com/user/$foo/whatever' rather than $foo.myapp.com/whatever, but that is the only drawback I can see. -J
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
