ubuntuusers.de

Apache Proxy http/https

Status: Ungelöst | Ubuntu-Version: Ubuntu 22.04 (Jammy Jellyfish)
Antworten |

Tim42

Anmeldungsdatum:
12. Dezember 2022

Beiträge: Zähle...

Hallo Zusammen,

ich habe ein Problem und hoffe, dass jemand vielleicht irgendetwas schlaues dazu sagen kann. Und zwar möchte ich Apache/2.4.41 auf einem Ubuntu 22.04 Server verwenden, um einen Proxy-Server zu schaffen. Dieser soll einfach nur alle Anfragen, die über Port 443 (https) an eine bestimmte (Sub-)Domain kommen, an einen Server umleiten.

Hier ein paar (Fake-)Daten zum Nachvollziehen:

  • die Subdomain sei "mysub.mydomain.de"

  • die IP des Proxy-Servers sei "101.102.103.104"

  • die IP des Ziel-Servers sei "106.107.108.109"

  • die Subdomain wird einfach per A-Record auf die Proxy-Server-IP umgeleitet

Mein Config-File unter /etc/apache2/sites-available/000-default.conf sieht so aus:


<VirtualHost mysub.mydomain.de:443>
    ServerName mysub.mydomain.de

    SSLEngine on
    SSLProxyEngine on
    SSLProxyVerify none
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    SSLProxyCheckPeerExpire off    
    ProxyPreserveHost on
    ProxyRequests off

    SSLCertificateFile /etc/apache2/sites-available/Zert/public.crt
    SSLCertificateKeyFile /etc/apache2/sites-available/Zert/private.key
    SSLCertificateChainFile /etc/apache2/sites-available/Zert/intermediate.crt

    ProxyPass "/" "https://106.107.108.109:443"
    ProxyPassReverse "/" "https://106.107.108.109:443"
</VirtualHost>

Wenn ich nun im Browser "https://mysub.mydomain.de" eingebe, bekomme ich folgende Seite angezeigt:


Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
Apache/2.4.41 (Ubuntu) Server at mysub.mydomain.de Port 80

Hat jemand eine Idee, warum es nicht funktioniert? An welcher Stelle wird von https zu http gewechselt?

Unter /var/log/apache2/other_vhosts_access.log finde ich folgendes zu meinem Aufruf (IPs geändert):

mysub.mydomain.de:443 217.173.152.198 - - [12/Dec/2022:17:27:41 +0100] "GET / HTTP/1.1" 302 5971 "-" "Mozilla/5.0 [...] 7.36"
mysub.mydomain.de:80 217.173.152.198 - - [12/Dec/2022:17:27:41 +0100] "GET / HTTP/1.0" 400 631 "-" "-"
mysub.mydomain.de:80 217.173.152.198 - - [12/Dec/2022:17:27:41 +0100] "GET / HTTP/1.0" 400 631 "-" "-"

An dieser Stelle kommt also schon irgendwie Port 80 (http) ins Spiel...?

Viele Grüße und Danke im Voraus, Tim

Antworten |