birdyb
Goto Top

Apache Reverseproxy - Umleitung fehlerhaft

Hallo zusammen,

ich hab da mal wieder ein kleines Problem: Ich möchte einen Apache2 als ReverseProxy betreiben. Da ich einige hosts immer mal wieder ändere habe ich mir folgende 2 Makros geschrieben:

Für Seiten mit HTTP-Backend:
<Macro RProxy $hostname $ip_address $dest_port>
<VirtualHost *:80>
    ServerName $hostname

    ProxyPreserveHost On
    ProxyPass / http://$ip_address:$dest_port/
    ProxyPassReverse / http://$ip_address:$dest_port/
</VirtualHost>

<VirtualHost *:443>
    ServerName $hostname

    # SSLProxyEngine On
    ProxyPreserveHost On
    ProxyPass / http://$ip_address:$dest_port/
    ProxyPassReverse / http://$ip_address:$dest_port/

    SSLEngine on
    SSLCertificateFile /etc/ssl/domain.tld/ssl.crt
    SSLCertificateKeyFile /etc/ssl/domain.tld/ssl.key
    SSLCertificateChainFile /etc/ssl/domain.tld/sub.class2.server.ca.pem
</VirtualHost>
</Macro>

Und für Seiten mit HTTPS-Backend:
<Macro RProxySSL $hostname $ip_address $dest_port>
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>

<VirtualHost *:443>
    ServerName $hostname

    SSLProxyEngine On
    ProxyPreserveHost On
    ProxyPass / http://$ip_address:$dest_port/
    ProxyPassReverse / http://$ip_address:$dest_port/

    SSLEngine on
    SSLCertificateFile /etc/ssl/domain.tld/ssl.crt
    SSLCertificateKeyFile /etc/ssl/domain.tld/ssl.key
    SSLCertificateChainFile /etc/ssl/domain.tld/sub.class2.server.ca.pem
</VirtualHost>
</Macro>

In der Site-Config für Apache habe ich dann folgendes angegeben:
NameVirtualHost *:80
NameVirtualHost *:443

Use RProxy host1.domain.tld 10.0.2.101 80
Use RProxySSL host2.domain.tld 10.0.2.2 8006

Unglücklicherweise werde ich beim Aufruf von host2.domain.tld leider an die Adresse von host1 weitergeleitet.
Hat jemand eine Idee, wo ich den Fehler gemacht habe?

Danke für die Hilfe!


Beste Grüße!


Berthold

Content-Key: 257160

Url: https://administrator.de/contentid/257160

Printed on: April 19, 2024 at 14:04 o'clock

Member: BirdyB
BirdyB Dec 09, 2014 at 14:14:26 (UTC)
Goto Top
Hat sich schon erledigt. Ein weiterer Neustart des Apache hat das Problem beseitigt.
Das nächste Problem befand sich übrigens im zweiten Macro, denn für das SSL-Backend muss es natürlich http*s* heißen...