Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Is there any way of bypassing the http request when localhost used as PROXY_PASS in case of cache miss in nginx

$
0
0
Hi,

I am using my custom module for response when cache miss happens. When cache miss is happening proxy server is making another http request to localhost and then it is coming to the "location /kunal". So I am trying to bypass this extra http request.

Is there anyway to directly call my custom module "kunal_custom" when cache miss happens without doing extra http request to localhost.
Please help me out. I am fully stuck here.

I am using following nginx config

location / {
root html;
index index.html index.htm;

access_log /etc/nginx/logs/cache-server-1.log nginx_cache;
error_log /etc/nginx/logs/error-server-1.log debug;
#listen 8072;
#proxy_read_timeout 600;
proxy_cache cache_zone;
proxy_cache_valid 200 10m;
proxy_pass http://localhost/kunal/;

proxy_redirect off;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

# redirect server error pages to the static page /50x.html
#
error_page 404 403 500 502 503 504 /kunal;
location /kunal {
kunal_custom;
}

Thanks,
Kunal

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>