confused_elf has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm currently stuck with this problem, I currently using apache2/modperl2 with catalyst and TT.

the problem is that when i run the server,

say http:://my-pc/index.html works fine, it loads up and serves the images

This is the output from my /var/log/apache2/error.log

[info] *** Request 3 (0.001/s) [12648] [Tue Sep 18 15:28:33 2007] *** [debug] "GET" request for "/" from "127.0.1.1" [debug] Rendering template "index.tt" [info] Request took 0.092404s (10.822/s) .----------------------------------------------------------------+---- +-------. | Action | Time | +----------------------------------------------------------------+---- +-------+ | /index | 0.0 +34688s | | /end | 0.0 +49980s | | -> MyApp::View::TT->process | 0.046271s | '----------------------------------------------------------------+---- +-------' but anytime I have a non root request, for example, http://my-pc/category/index.html, it only serves the text part and not the images, [info] *** Request 1 (0.000/s) [12649] [Tue Sep 18 15:30:58 2007] *** [debug] "GET" request for "category/index.html" from "127.0.1.1" [debug] Path is "category/index.html" [debug] Rendering template "category/index.tt" [debug] Rendering template "category/index.tt" [info] Request took 0.119325s (8.380/s) .----------------------------------------------------------------+---- +-------. | Action | Tim +e | +----------------------------------------------------------------+---- +-------+ | /category/index | 0. +081885s | | -> MyApp::View::TT->process | 0.056685s | | /category/end | 0. +024370s | | -> MyApp::View::TT->process | 0.023263s | '----------------------------------------------------------------+---- +-------' [info] *** Request 1 (0.000/s) [12654] [Tue Sep 18 15:30:58 2007] *** [debug] "GET" request for "category/static/images/lnav_search_btn.gif" + from "127.0.1.1" [debug] Arguments are "category/static/images/lnav_search_btn.gif" [debug] Rendering template "category/default" [error] Couldn't render template "file error - category/default: not f +ound" [error] Couldn't render template "file error - category/default: not f +ound" [info] Request took 0.052850s (18.921/s) .----------------------------------------------------------------+---- +-------. | Action | Tim +e | +----------------------------------------------------------------+---- +-------+ | /category/default | 0. +000608s | | /category/end | 0. +006530s | | -> MyApp::View::TT->process | 0.004926s | '----------------------------------------------------------------+---- +-------' [info] *** Request 8 (0.003/s) [12646] [Tue Sep 18 15:30:58 2007] *** [debug] "GET" request for "category/static/images/h_keyword.gif" from +"127.0.1.1" [debug] Arguments are "category/static/images/h_keyword.gif" [debug] Rendering template "category/default" [error] Couldn't render template "file error - category/default: not f +ound" [error] Couldn't render template "file error - category/default: not f +ound" [info] Request took 0.023435s (42.671/s) .----------------------------------------------------------------+---- +-------. | Action | Tim +e | +----------------------------------------------------------------+---- +-------+ | /category/default | 0. +000391s | | /category/end | 0. +004704s | | -> MyApp::View::TT->process | 0.003614s | '----------------------------------------------------------------+---- +-------'
both of the pages on http://my-pc/index.html and http://my-pc/category/index.html is exactly the same. but somehow, the non-root request for the image always goes to the default path.

does anyone has any experience on this?, I've been trying to find out what the problem is for 2 days now.

Thanks in advance for the help guys.

Please let me know if you guys need more information

Thanks,

confused elf

20070921 Janitored by Corion: Put output in code tags, as per Writeup Formatting Tips

  • Comment on catalyst/apache problem with non root request not able to serve images
  • Download Code

Replies are listed 'Best First'.
Re: catalyst/apache problem with non root request not able to serve images
by moritz (Cardinal) on Sep 18, 2007 at 09:12 UTC
    The problem is probably that you use relative URLs in the HTML, so in /index.html an image static/foo.gif is mapped to /static/foo.gif, but in /category/index.html it is mapped to /category/static/index.html which doesn't exist.

    You can avoid that by using absolute image pathes, like /static/foo.gif.

      you are absolutely right, I feel so stupid now. I really thought that catalyst would handle that automatically. I should've thought about that. Thanks a lot though for the quick help, I appreciate it. Thankss confused elf