Hallo Leute,

wir haben einen Server mit RHEL7 und ich muss dort mit Apache und ModPerl einige VirtualHosts einrichten.
Mit ModPerl, denn es wird alles dynamisch gemacht.

Nun habe ich ein sehr komisches Problem, das ich nicht verstehen kann.

Ich packe alles in mehreren Variablen, je nachdem was die Abschnitte machen, dann habe ich dieses Konstrukt:

while( my ($domain, $cert) = each %codomains )
{
  $config = <<CONFIG;
<VirtualHost *:80>
    ServerName $domain

    $generalVHost

    <Location "/">
        # Uncomment the next line to deny embedding this site in (i)frames
        #Header always set X-Frame-Options DENY

        $proxyPHP

        FileETag All
        ExpiresActive on
        ExpiresDefault "access plus 10 minutes"
        Header merge Cache-Control public

AddOutputFilterByType DEFLATE text/html text/css text/javascript application/x-javascript application/x-httpd-php text/plain image/svg+xml

        Require all granted
    </Location>
    $otherLocations
</VirtualHost>

<VirtualHost *:443>
    ServerName $domain

    SSLEngine On
    SSLProxyEngine on
    Include common/cert.$cert.conf

    $generalVHost

    <Location "/">
        Header always set Strict-Transport-Security "max-age=16416000"
        # Uncomment the next line to deny embedding this site in (i)frames
        #Header always set X-Frame-Options DENY
        RequestHeader set X-Forwarded-Ssl on
        RequestHeader set X-Forwarded-Proto https
        RequestHeader set X-Forwarded-Port 443
        RequestHeader set SSL_CLIENT_CERT %{SSL_CLIENT_CERT}e
        RequestHeader set SSL_PROTOCOL %{SSL_PROTOCOL}e
        RequestHeader set SSL_CIPHER %{SSL_CIPHER}e
        RequestHeader set SSL_SESSION_ID %{SSL_SESSION_ID}e
        RequestHeader set SSL_CIPHER_USEKEYSIZE %{SSL_CIPHER_USEKEYSIZE}e
        RequestHeader set SSL_CLIENT_VERIFY %{SSL_CLIENT_VERIFY}e

        $proxyPHP

AddOutputFilterByType DEFLATE text/html text/css text/javascript application/x-javascript application/x-httpd-php text/plain image/svg+xml

        Require all granted
    </Location>
    $otherLocations
</VirtualHost>
CONFIG

  $s->add_config([split /\n/, $config]);
}

Und hier kommt das Problem...
Wenn ich $otherLocations weg lasse, geht alles, sobald ich sie einbinde wird der VirtualHost ignoriert.
Der Inhalt der Variable ist diese:

$otherLocations = <<LOCATIONS;
    <Location "/typo3">
        AuthName               "Bitte authentifizieren"
        AuthType               Basic
        AuthBasicProvider      crowd
        CrowdURL               https://url.to.crowd/
        CrowdTimeout           10
        CrowdAcceptSSO         On
        CrowdCreateSSO         On
        CrowdAppName           mycrowdapp
        CrowdAppPassword       "verysecretpassword"
        <RequireAll>
            <RequireAny>
                Include common/ip.all_restricted.conf
            </RequireAny>
            Require crowd-group <viele viele viele Crowd-Gruppen>
        </RequireAll>
    </Location>
LOCATIONS

Wenn ich die Gruppen bei "Require crowd-group" stark reduziere (weniger als ein Drittel), dann geht es, sonst wird der VirtualHost ignoriert...
Ich merke mit httpd -S dass die VirtualHosts einfach fehlen.

Inzwischen habe ich wirklich keine Idee mehr, was ich noch probieren kann.
Das "lustige" ist, dass wenn ich die Variabel $config ausgebe und in eine Datei speichere, kann ich diese Datei problemlos in die Apachekonfiguration einbinden und es geht.
Also, inhaltlich ist es kein Problem.

Ich freue mich auf eure Vorschläge um das Problem zu finden (und korrigieren!).

Danke
Luca Bertoncello
([email protected])


Antwort per Email an