I need to configure an nginx server so that:
If user has a specific cookie so the server must send a file, else the server must send another one. I read plenty of related articles, but nothing helped, also I know that there is some issues when try_files
meets location if
but how to resolve this...
I have an example, which should be working, but not in fact:
upstream site {
server localhost:4321;
}
server {
listen *:1234;
server_name site.com;
root /path/www/;
ssl on;
ssl_certificate /path/ssl.crt;
ssl_certificate_key /path/ssl.key;
location = / {
set $variable /path/index.html;
if ($http_cookie ~* "someCookie=someValue(?:;|$)") {
set $index_file /path2/index.html;
}
rewrite .* $index_file break;
try_files $uri/index.html $uri.html $uri @site;
}
}