post_action, just send http request, not fcgi - more questions + post_action bug?

Rob Mueller robm at fastmail.fm
Tue Mar 18 02:25:23 MSK 2008


Hi Igor

>> Also what actually happens to the content that proxy_pass returns in this
>> case. I really want it to just "disappear", and for the moment it does 
>> seem
>> to do that, but is that guaranteed?
>
> Yes, nginx does not send post_action content to a client.

I've found two issues with using this setup, both of which are rather 
annoying. As a reminder, here's the setup.

---
    location / {
      proxy_pass                  http://backend/dav/;
      proxy_intercept_errors      off;
      proxy_next_upstream         off;
..
      post_action                 @ratepostaction;
    }

    location @ratepostaction {
...
      proxy_pass_request_body off;
      proxy_pass_request_headers off;
      proxy_pass http://unix:/var/state/ratetrack/ratepostaction:;
    }
---

Problem 1

If the upstream returns an error (eg 404 not found response), then the 
access log seems to log the result of the @ratepostaction proxy response, 
rather than the 404 response

For example, here's what a log line looks like if the backend returns a 404 
response.

127.0.0.2 [18/Mar/2008:10:18:57 +1100] "dav.messagingengine.com/Contents" 
200 489 dav.messagingengine.com "-" "WebDAVFS/1.4.1 (01418000) Darwin/8.11.1 
(i386)" TIME=0.607 GZIP=-

If I comment out the post_action line above and rerun the same request:

127.0.0.2 [18/Mar/2008:10:20:05 +1100] "dav.messagingengine.com/Contents" 
404 489 dav.messagingengine.com "-" "WebDAVFS/1.4.1 (01418000) Darwin/8.11.1 
(i386)" TIME=0.049 GZIP=-

Problem 2

If the upstream returns an error (eg 404), then nginx returns that message 
to the client as follows:

---
HTTP/1.1 404 Not Found
Server: nginx/0.5.35
Date: Mon, 17 Mar 2008 22:48:13 GMT
Content-Type: text/html; charset=iso-8859-1
Transfer-Encoding: chunked
Connection: keep-alive

11e
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /dav/Contents was not found on this server.<P>
<HR>
<ADDRESS>Apache/1.3.34 Server at dav.messagingengine.com Port 80</ADDRESS>
</BODY></HTML>

0

---

But rather than actually keeping the connection open, it immediately closes 
it. This seems to be annoying some clients.

Again, if you remove the post_action call, it does keep the connection open 
fine.

Rob






More information about the nginx mailing list