[Catalyst] website member urls

J. Shirley jshirley at gmail.com
Thu Apr 30 11:09:51 GMT 2009


On Thu, Apr 30, 2009 at 7:14 PM, Octavian Rasnita <orasnita at gmail.com>wrote:

>  *From:* Merlyn Kline <merlyn at zynet.net>
>
>
>
>  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 sin=
ce
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090430/39300=
88c/attachment.htm


More information about the Catalyst mailing list