Location_Capture_By_Lua and Reverse Proxy Cache
shubham s.
lists at ruby-forum.com
Thu Sep 5 07:45:51 UTC 2013
Hi,
Was trying to get hold of the response recieved through upstream server
or through nginx cache . However found that thier's no cache hit when
doing this way .
for brevity just posting the relevant code : looks like for something
out there through which cache is ignored : also the headers out of
Passenger_backed are not returned through the conetnt_by_lua stuff.
location / {
content_by_lua '
local res = ngx.location.capture(
"/passenger_backend",
{ method = ngx.HTTP_POST, body = ngx.var.request_body})
ngx.header["X-My-Header"] = "blah blah"
ngx.log(ngx.CRIT,"Inside Content : " , "hello")
ngx.say(res.body)
';
}
======
location /passenger_backend {
proxy_pass http://web_units;
proxy_cache small;
proxy_cache_methods POST;
proxy_cache_key "$request_uri|$request_body";
client_max_body_size 500M;
open_file_cache max=200000 inactive=50s;
open_file_cache_valid 50s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
################# Gzip Settings ################
gzip on;
gzip_comp_level 6;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
#gzip_proxied any;
#gzip_static on;
gzip_types text/plain text/css application/json application/x-javascript
text/xml application/xml application/xml+rss text/javascript
application/javascript text/x-js;
gzip_disable "MSIE [1-6]\.";
###################################################
proxy_buffering on;
proxy_buffers 8 32M;
proxy_buffer_size 64k;
proxy_cache_valid 200 302 72h;
# proxy_cache_valid 404 10m;
fastcgi_read_timeout 120s;
fastcgi_send_timeout 120s;
proxy_read_timeout 120s;
proxy_connect_timeout 120s;
proxy_cache_use_stale updating;
add_header X-Cached $upstream_cache_status;
set_real_ip_from 10.86.102.0/24;
real_ip_header X-Forwarded-For;
proxy_ignore_headers Set-Cookie;
proxy_ignore_headers Cache-Control;
}
--
Posted via http://www.ruby-forum.com/.
More information about the nginx
mailing list