I need to serve static file (index.html) with react running on it to everybody except google, facebook & twitter (plus some short list of other good bots).
My idea was to use something like
if ($http_user_agent!~* (Google|Facebot|Twitterbot))
{
try_files $uri $uri/ /index.html;
}
proxy_pass http://127.0.0.1:3003/;
...
Nice solution but apparently if is evil and I can not use try_files inside of it (getting an error on config launch). I tried to reverse logic and do proxy_pass inside if, but the result is the same.
What is preferred way to solve this situation?