Hi,
location /api {
if ($cookie_API) {
### make a http request to the varnish backend
# check if the varnish response contains x-api-ok
if ($http_X_API_OK) {
proxy_pass http://api-aaa/;
}
}
proxy_pass http://api-bbb/;
}
what I want to do is the following:
If the incoming request has a cookie named API, then nginx sends a http request to a varnish backend.
If the varnish response header contains X-API-OK, then nginx processed a proxy request to api-aaa. If a cookie is not set or the http response header does not has X-API-OK set, then a proxy request to api-bbb is processed.
Is that possible with nginx?
Cheers
Jonny
location /api {
if ($cookie_API) {
### make a http request to the varnish backend
# check if the varnish response contains x-api-ok
if ($http_X_API_OK) {
proxy_pass http://api-aaa/;
}
}
proxy_pass http://api-bbb/;
}
what I want to do is the following:
If the incoming request has a cookie named API, then nginx sends a http request to a varnish backend.
If the varnish response header contains X-API-OK, then nginx processed a proxy request to api-aaa. If a cookie is not set or the http response header does not has X-API-OK set, then a proxy request to api-bbb is processed.
Is that possible with nginx?
Cheers
Jonny