title: NGINX: Redirect a user based on cookie for a specific URL only
body: <p>I'm building a closed social network and currently when a user is not logged in they will always be redirected to the homepage of my domain. </p>
  
  <p>What I would like to do is do the following:</p>
  
  <ol>
  <li><p>Use NGINX to check if a user is logged in (through checking for a cookie) and then when they go to the homepage (mydomain.com) redirect to to mydomain.com/newsfeed.</p></li>
  <li><p>This check should only be applied when a user brows to the homepage and should not work at ANY other url (or else they would always be redirected).</p></li>
  </ol>
  
  <p>I'm very new to NGINX and looked at various tutorials for using cookies for redirect but failed to get an answer (most notably to limiting the redirect to only the homepage). </p>
  
  <p>Thanks in advance!</p>