# Post\_action vs error\_page seems doesn't work

**URL:** <https://www.ruby-forum.com/t/post-action-vs-error-page-seems-doesnt-work/203869>\
**Category:** NGINX\
**Created:** [February 28, 2011, 10:49pm UTC](https://www.ruby-forum.com/t/post-action-vs-error-page-seems-doesnt-work/203869 "2011-02-28T22:49:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 28, 2011, 10:49pm UTC](https://www.ruby-forum.com/t/post-action-vs-error-page-seems-doesnt-work/203869/1 "2011-02-28T22:49:15Z")

</div>

hi,  
what I want to do is:

1. trying to serve content like url =\>  
[http://my.domain.tld/static/bla-bla-bla?id=12345](http://my.domain.tld/static/bla-bla-bla?id=12345)
2. check an html page on cache (on redis)
3. if doesn’t exists, let’s create it (via php script  
/api/entrypoint.php?.. )
4. always update statistical counters (asyncronous batch)

problem:  
step 4) never processed until I comment “error page 404 = …”.  
In thi case all request to redis are processed (via 127.0.0.1:33333 and  
127.0.0.1:22222) but a 404 error on browser too ☹

my nginx.conf

location ^~ /static/ {

# 2) check an html page (on redis)

set $redis\_key “my:permalink:$arg\_id:html”;  
redis\_pass 127.0.0.1:33333;

# 3) if doesn’t exists, let’s create it (via php)

error\_page 404 = /api/entrypoint.php?action=do\_html&id=$arg\_id;

# 4) always update statistical counters (asyncronous batch)

post\_action /update\_counters;  
}

location /update\_counters {

set $queue\_name ‘my:queue:to:process:asyncronous’;  
redis2\_query lpush $queue\_name $request\_uri;  
redis2\_pass 127.0.0.1:22222;

}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ .php$ {

root html;  
fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_index index.php;  
fastcgi\_param SCRIPT\_FILENAME $document\_root$fastcgi\_script\_name;  
include fastcgi\_params;

}

thanks  
maxf3r

---

<div class="post-metadata">

**Author:** ![massimo\_ferrari](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9f8e36/32.png) [@massimo\_ferrari](https://www.ruby-forum.com/u/massimo_ferrari)\
**Post date:** [March 1, 2011, 9:57am UTC](https://www.ruby-forum.com/t/post-action-vs-error-page-seems-doesnt-work/203869/2 "2011-03-01T09:57:56Z")

</div>

Hello!

On Mon, Feb 28, 2011 at 10:47:21PM +0100, massimo ferrari wrote:

> problem:  
> step 4) never processed until I comment “error page 404 = …”.  
> In thi case all request to redis are processed (via 127.0.0.1:33333 and  
> 127.0.0.1:22222) but a 404 error on browser too ☹

You have to specify post\_action for your error\_page as well.

Maxim D.
