Re: How to get “my” VHOST in code executed by Pe rPostConfigRequire?

John Dunlap <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC5eUSvRsae0a2MStY233KCpC-JFte3kxnkRnij2H-Hb0GNH9Q@mail.gmail.com>
We do it with PerlSetVar:
  PerlSetVar vhost MY_COOL_SITE

On Mon, Aug 5, 2019 at 1:19 PM Thorsten Schöning <[email protected]>
wrote:

> Hi all,
>
> I'm hosting multiple instances of the same web app in different
> versions using the same instance of HTTPd and one VHOST per
> instance/version of web app currently. I would like to use mod_perl's
> "PostConfigRequire" to implement a handler pre-loading all those
> instances during server startup instead of relying on mod_perl's
> registry-facilities per request, as is done currently. The latter
> [breaks][1] in case of too many concurrent requests and according to
> some tests, that problem doesn't occur anymore in case things get
> pre-loaded.
>
> Because of the different versions of my web app, I need to use
> "PerlOptions +Parent" to provide each VHOST with its individual Perl
> interpreter pool. Additionally, I can easily configure
> "PerlPostConfigRequire" per VHOST, but pre-loading needs to take into
> account which VHOST that handler is currently executed in. Within that
> handler I need to only load those files associated with some concrete
> VHOST.
>
> The problem is that I'm having trouble how to find the VHOST currently
> executing that handler. In that past I have implemented something
> similar per request by looking at the currently requested URL and
> comparing that to VHOST configs, but I don't have a request now.
> "Apache2::ServerUtil->server()" is not providing my VHOST, but it's
> available at all e.g. using
> "Apache2::Directive::conftree()->lookup('VirtualHost')". Only that I
> don't know which one is the one containing "PerlPostConfigRequire"
> currently executed. I'm pretty sure that "PerlPostConfigRequire"
> really gets executed per VHOST, because I get debugging output scaling
> with the number of VHOSTs configured as well.
>
> Any ideas? Thanks!
>
> [1]:
> http://mail-archives.apache.org/mod_mbox/perl-modperl/201907.mbox/%3C1116164701.20190731193313%40am-soft.de%3E
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning       E-Mail: [email protected]
> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>
> Telefon...........05151-  9468- 55
> Fax...............05151-  9468- 88
> Mobil..............0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
>
>

-- 
John Dunlap
*CTO | Lariat *

*Direct:*
*[email protected] <[email protected]>*

*Customer Service:*
877.268.6667
[email protected]
100x60.png (image/png, 2.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.