Lighttpd mod_proxy mit http header authentification

Apache, Lighttpd, nginx, Cherokee
User avatar
daemotron
Administrator
Administrator
Posts: 2641
Joined: 2004-01-21 17:44
 

Lighttpd mod_proxy mit http header authentification

Post by daemotron »

Moin allerseits,

mich treibt gerade ein undokumentiertes "Feature" von Lighty's mod_proxy in den Wahnsinn. Kurz zum Szenario: Ich hab lighty als Reverse Proxy vor einem Zope Application Server laufen. Der Zugriff auf die diversen Produkte (u. a. Plone) funktioniert dank Virtual Host Monster problemlos. Nur der Zugriff auf die Root des ZMI will nicht funktionieren.

Was ich bisher herausgefunden habe: Der Request meines Browsers wird von Lighty korrekt übersetzt und an Zope übergeben. Zope will natürlich eine Header-Authentifizierung und antwortet mit 401. Lighty widerum sendet jetzt nicht etwa 401 an meinen Browser, sondern 200 und ein leeres Dokument :?

Hier mal die passenden Auszüge aus dem access_log von Lighty:

Code: Select all

91.5.249.68 - - [04/Feb/2007:18:45:48 +0100] "GET / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"
und passend dazu der von Zope:

Code: Select all

127.0.0.1 - Anonymous [04/Feb/2007:18:45:48 +0200] "GET /VirtualHostBase/https/manage.my-universe.com:443/manage/VirtualHostRoot/ HTTP/1.0" 401 583 "" "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"
Hier noch der entsprechende Konfigurationsabschnitt von lighttpd (innerhalb des Abschnitts für die SSL-Konfiguration):

Code: Select all

$HTTP["host"] =~ "(^|.)manage.my-universe.com$" {
    server.errorlog = "/home/my-universe/logs/ssl_error_log"
    accesslog.filename = "/home/my-universe/logs/ssl_access_log"

    url.rewrite-once = ( "^/(.*)$" =>
        "/VirtualHostBase/https/manage.my-universe.com:443/manage/VirtualHostRoot/$1" )

    proxy.balance = "hash"
    proxy.server  = ( "/VirtualHostBase" =>
        (( "host" => "127.0.0.1", "port" => 8080 ) ) )
}
Meine durch google und die mod_proxy-Dokumentation von Lighty bislang nicht beantwortete Frage: wie kriege ich lighttpd davon überzeugt, den 401er auch zurück an meinen Browser zu schicken, damit der entsprechend reagieren kann?

[EDIT]
Hier noch der passende Auszug aus error_log bei proxy.debug = 1:

Code: Select all

2007-02-04 19:31:52: (mod_proxy.c.1079) proxy - start
2007-02-04 19:31:52: (mod_proxy.c.1115) proxy - ext found
2007-02-04 19:31:52: (mod_proxy.c.1123) proxy - used hash balancing, hosts: 1
2007-02-04 19:31:52: (mod_proxy.c.1138) proxy - election: /VirtualHostBase/https/manage.my-universe.com:443/manage/VirtualHostRoot/ 127.0.0.1 manage.my-universe.com -71559186
2007-02-04 19:31:52: (mod_proxy.c.1239) proxy - found a host 127.0.0.1 8080
2007-02-04 19:31:52: (mod_proxy.c.377) connect delayed: 15
2007-02-04 19:31:52: (mod_proxy.c.993) proxy: fdevent-out 1
2007-02-04 19:31:52: (mod_proxy.c.804) proxy - connect - delayed success
2007-02-04 19:31:52: (mod_proxy.c.960) proxy: fdevent-in 4
2007-02-04 19:31:52: (mod_proxy.c.645) proxy - have to read: 583
2007-02-04 19:31:52: (mod_proxy.c.960) proxy: fdevent-in 4
2007-02-04 19:31:52: (mod_proxy.c.645) proxy - have to read: 0
[/EDIT]
Last edited by daemotron on 2007-02-04 19:37, edited 1 time in total.
User avatar
daemotron
Administrator
Administrator
Posts: 2641
Joined: 2004-01-21 17:44
 

Re: Lighttpd mod_proxy mit http header authentification

Post by daemotron »

Nachtrag: Das selbe abstruse Bild ergibt sich auch bei Verzicht auf das vhm-Objekt:

Code: Select all

$HTTP["host"] =~ "(^|.)manage.my-universe.com$" {
    server.errorlog = "/home/my-universe/logs/ssl_error_log"
    accesslog.filename = "/home/my-universe/logs/ssl_access_log"

    url.rewrite-once = ( "^/(.*)$" => "/manage/$1" )

    proxy.balance = "hash"
    proxy.server  = ( "/manage" =>
        (( "host" => "127.0.0.1", "port" => 8080 ) ) )
}
Lighty's access_log:

Code: Select all

91.5.249.68 - - [04/Feb/2007:19:00:54 +0100] "GET / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"
Zope-Log:

Code: Select all

127.0.0.1 - Anonymous [04/Feb/2007:19:00:54 +0200] "GET /manage/ HTTP/1.0" 401 583 "" "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"