I'm having some difficulties rewriting a location to https, then asking if a specific cookie or IP is matched and then pass it to a http backend. For example, I need the /api location rewritten to https since the whole domain is just http and don't may be rewritten completely to https. My intention is something like this:
location ^~ /api {
rewrite https://$http_host$request_uri; (rewrite the location to https)
if ($iporcookiematches != 1) { (and then check if the ip or cookie matches)
return 403;
}
proxy_pass http://backend;
}
Does it make sense? Is it somehow possible?
Cheers,
Szop
location ^~ /api {
rewrite https://$http_host$request_uri; (rewrite the location to https)
if ($iporcookiematches != 1) { (and then check if the ip or cookie matches)
return 403;
}
proxy_pass http://backend;
}
Does it make sense? Is it somehow possible?
Cheers,
Szop