spierdalaj chamie<br><br><div class="gmail_quote">2011/1/7 Roman Vasilyev <span dir="ltr"><<a href="mailto:roman@anchorfree.com">roman@anchorfree.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On 01/05/2011 09:02 PM, agentzh wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Wed, Jan 5, 2011 at 8:20 AM, Roman Vasilyev<<a href="mailto:roman@anchorfree.com" target="_blank">roman@anchorfree.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Let me show one variant of nginx.conf's:<br>
location / {<br>
include proxy.conf;<br>
eval_subrequest_in_memory off;<br>
eval_override_content_type text/plain;<br>
eval $res {<br>
include spam_fastcgi.conf;<br>
if ( $request_method = POST) {<br>
fastcgi_pass unix:/var/run/nginx/cgiwrap-dispatch.sock;<br>
}<br>
}<br>
if ( $res = SPAM) {<br>
rewrite ^ /terms-of-use.html redirect;<br>
}<br>
}<br>
<br>
</blockquote>
Please try the following:<br>
<br>
location = /check-spam {<br>
internal;<br>
<br>
include spam_fastcgi.conf;<br>
fastcgi_pass unix:/var/run/nginx/cgiwrap-dispatch.sock;<br>
}<br>
<br>
location / {<br>
client_max_body_size 100k;<br>
client_body_buffer_size 100k;<br>
<br>
lua_need_request_body on;<br>
<br>
rewrite_by_lua '<br>
<br>
</blockquote></div>
Thank you for quick response, and I afraid of my stupid questions about embedded lua but :) :<br>
1) I'm using current development nginx-0.9.3 (my internals need huge table ~350k domain records for 2 different nginx parameters) and doable in current version.<br>
2) when I'm just including *rewrite_by_lua* with simple return, I'm loosing all headers from parent cite, please help me with best solution for that.<br>
3) why you prefer NDK to clear nginx environment?<div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
if ngx.var.request_method ~= "POST" then<br>
return<br>
end<br>
local res = ngx.location.capture(<br>
"/check-spam",<br>
{ method = "POST", body = ngx.var.request_body }<br>
)<br>
if res.body == "SPAM" then<br>
return ngx.redirect("/terms-of-use.html")<br>
end<br>
';<br>
<br>
# ... your normal fastcgi_pass/proxy_pass/etc settings<br>
# go here ...<br>
}<br>
<br>
Please note that you need the git HEAD of the "master" branch of the<br>
ngx_lua git repos:<br>
<br>
<a href="https://github.com/chaoslawful/lua-nginx-module" target="_blank">https://github.com/chaoslawful/lua-nginx-module</a><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I have some foreign spam analyzer which I'm running like fastcgi server<br>
written in perl.<br>
I tried to use $request_body as fastsgi_param arg, it was empty;<br>
Wrote module which creates $post_body var in rewrite stage and with echo<br>
$post_body it works, but on subrequest it gives empty body (I guess because<br>
it not passing POST into subrequest)<br>
maybe somebody have any ideas how to realize it other way, or may be how to<br>
get POST in subrequest?<br>
<br>
<br>
</blockquote>
If you have further issues, feel free to report here ;)<br>
<br>
Happy nginx.conf hacking!<br>
-agentzh<br>
<br>
</blockquote>
<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><font color="#888888"><span style="color: rgb(0, 0, 0);">Z wyrazami szacunku</span><b style="color: rgb(0, 0, 0);"> Adrian Janeczek<br><br></b>
</font><br>