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

I am using Apache2::ModProxyPerlHtml[0] to reverse proxy several internal web servers, which are hyperlinked to on another. However, now I also need to serve up static web pages from this server.

However, it appears that mod_dir (DirectoryIndex) does not work for the static pages now.

Any help would be appreciated.
[0]http://www.samse.fr/GPL/

Replies are listed 'Best First'.
Re: mod_perl and DirectoryIndex
by naikonta (Curate) on Aug 08, 2007 at 01:38 UTC
    When people ask about something wrong with their code, they usually put some snippets of their relevant code so people can review what's wrong with it. Now you ask about using a (mod_perl based) module and you seem to have complex scheme and something doesn't work as you expected. I'm not familiar with the module in question and I think your problem has something to do with your apache configurtaion.

    This is a Perl forum, so your question could be off-topic. But we don't generally ban off-topic questions or discussion here, specially if it still relates to Perl or can give us all new insight regarding our Perl knowledge or programming at general.

    Please be more explicit about what you're doing. A sample of relevant httpd.conf snippet might help.


    Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

Re: mod_perl and DirectoryIndex
by clinton (Priest) on Aug 08, 2007 at 08:11 UTC
    You don't say how you are running your mod_perl, as handlers, or as ModPerl::Registry etc.

    I would hazard a guess that you are using Registry, or one of the other mod_perl enabled CGI-like environments. You have set Registry to handle a particular directory, and while /path/page works, when you make a request to /path/, you're not not getting the directory index that you expect.

    When Registry is set as the response handler for a location or directory, mod_dir never receives control.

    See this thread for more details about the problem, and see this post in particular for the solution.

    Clint

      First, I want to thank clinton for the relevant thread link. Fixup.pm
      package My::Fixup; use strict; use warnings FATAL => qw(all); use Apache2::Const -compile => qw(DIR_MAGIC_TYPE OK DECLINED); use Apache2::RequestRec; use Apache2::RequestUtil; sub handler { my $r = shift; if ($r->handler eq 'perl-script' && -d $r->filename && $r->is_initial_req) { $r->handler(Apache2::Const::DIR_MAGIC_TYPE); return Apache2::Const::OK; } return Apache2::Const::DECLINED; } 1;
      Add PerlFixupHandler line to httpd.conf
      PerlInputFilterHandler Apache2::ModProxyPerlHtml PerlOutputFilterHandler Apache2::ModProxyPerlHtml SetHandler perl-script PerlFixupHandler My::Fixup PerlAddVar ProxyHTMLURLMap "http://host.doamin.tld /host" PerlAddVar ProxyHTMLURLMap "http://host1.domain.tld /host1" PerlSetVar ProxyHTMLVerbose "On"

      What I am using closely mimics what is in the perldocs of http://www.samse.fr/GPL/ModProxyPerlHtml/Apache2-ModProxyPerlHtml-2.1/ModProxyPerlHtml.pm with the exception that now I am also serving static web pages off of this server as well.


      This seems to have worked.

      Thanks again Perl Monks.