Just an idea - modify the test server to serve under localhost:3000/myapp.

--
Zbyszek

On 11/16/06, Cédric Bouvier <[EMAIL PROTECTED]> wrote:
I have a ѕimple yet thorny problem, which I expect most of you also have
or had. It has several possible solutions, but I'm chiefly interested in
knowing how *you* would solve it and why.

We're developing a Catalyst application. It serves HTML, CSS,
JavaScript, and images. HTML is the output of TT2, but CSS, images and
JavaScript are static. We have them served by C::P::Static::Simple on
the built-in server, and we use a <Location> the have them directly
served by Apache/mod_perl, one the production server. Under mod_perl,
the application's root is not the server's root, i.e., it is
http://server/myapp, whereas it is http://localhost:3000 on the built-in
test server.

This would not be a problem if the CSS were not linking to images. And
because CSS pages are static, they cannot make use of uri_for(), and
therefore get the links to the pictures wrong.

Several solutions come to mind, and I cannot choose which one I like
best (or I dislike the least):
- have CSS served through TT2. I'm wondering about the extra load it
  would put on the Catalyst engine. Maybe it's completely negligeable,
  maybe not... Is it worth the effort to cache them? If so, what are the
  recommended best practices?
- make all links in CSS relative. This makes it harder to spread the
  stylesheets in a deep directory structure, unless one is willing to
  tediously count the ../../.. (or was it ../..?) and count them again
  when a stylesheet moves.
- insist that MyApp be installed at the server's root, bribing the
  sysadmin if need be (or threatening, or loudly shouting at, or blackmailing, 
or
  sacking, torturing...)
- use some black magic involving mod_rewrite or even HTTP::Proxy to
  modify the broken links on the fly... Hmmm, blackmailing the sysadmin
  should be easier than having him tweak mod_rewrite...
- Pre-process the CSS at install time, with some sort of ttree, and then
  serve them as static content.

Any war stories worth telling, Gentlemen, Ladies?

--
C é d r i c   B o u v i e r


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFFXNyPV+dbgD38PGgRAm5zAJ9/pza47+h+EsqnOI5jyp69wBkgZQCdGIEF
GlllH30KkWhmcg6G/zLfFnQ=
=YG65
-----END PGP SIGNATURE-----


_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/





--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to