Welcome! Log In Create A New Profile

Advanced

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

Posted by kunaldas 
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



Edited 1 time(s). Last edit at 07/20/2017 06:32AM by kunaldas.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 308
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready