My site has a search function at /search/
. For every search request captured by nginx, I want to run a Python script and have nginx behave differently depending on the output of said script, whether it's the exit code or stdout. So something like this (pseudocode):
location ~* "/search/(.*)" {
set redirect_request = call "/usr/bin/python /home/me/script.py $1";
if ($redirect_request = 1) {
rewrite ^ /page;
}
}
Is anything like this possible at all with nginx?