[Apache2] mod_proxy löscht Doctype

ZeroEnna

Erfahrenes Mitglied
Hallo zusammen

Ich setzte seit kurzem einen Apache2 mit mod_proxy als Reverse Proxy. Da in manchen PHP-Scripts die Variable $_SERVER['PHP_SELF'] eingesetzt wird und diese den URL für den lokalen Server und nicht den vom Reverse Proxy ausgibt, filtere ich die Ausgabe noch mit Hilfe von mod_proxy_html.

Das Problem ist aber, dass mir das Modul immer das HTML-Dokument verändert. Sieht der Head bevor er in den Filter kommt noch so aus:

HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <link rel="stylesheet" type="text/css" href="../../css/style.css" />.....
</head>
sieht das Ganze nachdem es den Filter durchlaufen hat wie folgt aus:

HTML:
<html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="../../css/style.css">...</head>
Also, wie ihr seht löscht es mir die Doctype-Angabe und schreibt den gesamten Head auf eine Zeile.

Seit ihr auch schon auf das Problem gestossen und weiss eventuell jemand woran das liegt und wie man es lösen kann?

Die Konfiguration sieht wie folgt aus:

Das Laden des Moduls:
Code:
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadFile /usr/lib/libxml2.so.2
LoadModule proxy_html_module /usr/lib/apache2/modules/mod_proxy_html.so
<IfModule mod_proxy.c>
        #turning ProxyRequests on and allowing proxying from all may allow
        #spammers to use your proxy to send email.

        ProxyRequests Off
        SSLProxyEngine On
        <Proxy *>
                AddDefaultCharset off
                Order deny,allow
                #Deny from all
                Allow from all
        </Proxy>

        # Enable/disable the handling of HTTP/1.1 "Via:" headers.
        # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
        # Set to one of: Off | On | Full | Block

        ProxyVia On
</IfModule>
Die Proxy Konfiguration:
Code:
    ProxyPass /pfad http://intern.server
    ProxyPassReverse /pfad http://intern.server
    <Location /pfad>
        SetOutputFilter proxy-html
        ProxyHTMLURLMap http://intern.server http://extern.server/pfad
    </Location>
Gruss
ZeroEnna
 
Hi ZeroEnna,

ich bin auch auf das Problem gestoßen.
Hast Du eine Lösung gefunden? Oder einen erklärenden Link?

Grüße
Matthias
 
Hallo, ich nochmal.

Ich habe herausgefunden, dass das mod_proxy_html auf meinem Ubuntu mit
Code:
SetOutputFilter  proxy-html
den Doctype ersatzlos streicht.
Man kann zwar mit
Code:
ProxyHTMLDoctype XHTML
ein "strict" doctype wieder manuell einfügen, verliert aber den originalen...

So habs ich zumindest verstanden :S

Links zum lesen:
http://www.apachetutor.org/admin/reverseproxies -> The proxy appears to change my HTML
http://apache.webthing.com/mod_proxy_html/config.html -> ProxyHTMLDoctype
 

Neue Beiträge

Zurück