lighttpd forum lighty > mod_auth + mod_fastcgi stalls

Posted by Bernhard Weißhuhn
on 15.12.2005 15:09
I'm experiencing strange stalls with lighttpd-1.4.8 that only seem to 
happen when I mod_auth-protect a fastcgi directory.
Both parts alone work great: If I remove the fastcgi.server entry, the 
authentication just works as expected. If I use the fastcgi-part without 
the authentication, if also works. But using both together stalls 
requests.

The server is sending the "401 Unauthorized"-Header and "Connection: 
close" just as expected, but obviously does NOT close the connection. 
The browser hangs for a long time, until something in lighty times out 
with the logmessage:

  "(server.c.960) NOTE: a request for /trac/ timed out after writing 147 
bytes.
  We waited 360 seconds. If this a problem increase 
server.max-write-idle."

Only then the browser asks for the credentials and everything rolls 
along nicely IF the correct credentials are entered. If not, the whole 
thing starts over.

Is this a bug or am I doing something wrong? Should I file a bug report 
in trac for this?

TIA,
bkw


Here are the relevant parts of my configfile:
-----------------------------------------------------------------

server.document-root = "/mnt/cvsvnroot/trac"
server.modules = ("mod_fastcgi","mod_alias","mod_setenv","mod_auth")

auth.backend = "ldap"
auth.backend.ldap.hostname = "ldap.example.com"
auth.backend.ldap.base-dn  = "dc=example,dc=com"
auth.backend.ldap.filter   = "(ou=People,dc=example,dc=com,uid=$)"

alias.url = ("/trac/chrome/common" => "/usr/share/trac/htdocs")

auth.require = (
  "/trac" => (
    "method"  => "basic",
    "realm"   => "trac",
    "require" => "valid-user"
  )
)

$HTTP["url"] =~ "^/trac(?!/chrome/common)" {
  fastcgi.server = (
    "/trac" => (
      "trac" => (
        "socket" => "/mnt/cvsvnroot/trac/run/trac-fastcgi.sock",
        "bin-path" => "/usr/share/trac/cgi-bin/trac.fcgi",
        "check-local" => "disable",
        "bin-environment" => (
          "TRAC_ENV_PARENT_DIR" => "/mnt/cvsvnroot/trac/projects",
          "LC_TIME" => "de_DE"
        )
      )
    )
  )
}
Posted by Bernhard Weißhuhn
on 15.12.2005 15:59
bkw wrote:
> I'm experiencing strange stalls with lighttpd-1.4.8 that only seem to 
> happen when I mod_auth-protect a fastcgi directory.

[...]

> Here are the relevant parts of my configfile:
> -----------------------------------------------------------------
> 
> server.document-root = "/mnt/cvsvnroot/trac"
> server.modules = ("mod_fastcgi","mod_alias","mod_setenv","mod_auth")
                     ^^^^^^^^^^^^                           ^^^^^^^^^^

That was the culprit! Apearantly, the order is important here.
Moving mod_auth to the beginning made things work.

P.S. I consider this a bug or at least lacking documentation ;-)
cheers,
bkw