lighttpd forum lighty > Proxy status code problem

Posted by Jiri Zajpt (Guest)
on 08.06.2007 17:01
I have problem with mod proxy. I have main lighttpd instance running on 
port 80 which proxies to instances running on loopback on different 
ports. The problem is with status code given by proxy. When I try to 
access some non-nexistent file on loopback instance it returns proper 
404 page with proper 404 code. But when I try to access through proxy on 
port 80 I got 404 page but 200 status code.


ACCESSING STRAIGHT:

bender ~ # telnet 127.0.0.1 50000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
GET /nonexistent HTTP/1.1
Host: www.blueberry.cz

HTTP/1.1 404 Not Found
....
<?xml version="1.0" encoding="iso-8859-1"?>
<!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" xml:lang="en" lang="en">
 <head>
  <title>404 - Not Found</title>
 </head>
...



ACCESSING THROUGH PROXY:

bender ~ # telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
GET /nonexistent HTTP/1.1
Host: www.blueberry.cz

HTTP/1.1 200 OK
...
<?xml version="1.0" encoding="iso-8859-1"?>
<!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" xml:lang="en" lang="en">
 <head>
  <title>404 - Not Found</title>
 </head>
...

Any help appreciated...
on 08.06.2007 21:07
Jiri Zajpt wrote:
> ACCESSING STRAIGHT:
[...]
> GET /nonexistent HTTP/1.1
> Host: www.blueberry.cz
> 
> HTTP/1.1 404 Not Found
[...]
> ACCESSING THROUGH PROXY:
[...]
> GET /nonexistent HTTP/1.1
> Host: www.blueberry.cz
> 
> HTTP/1.1 200 OK
[...]

Googling on server.error-handler-404, I found this:

http://www.postneo.com/2007/02/28/properly-serving-a-404-with-lighttpds-servererror-handler-404

-jcw