title: How to make a cookie available to all paths in a domain?
body: <p>I created a cookie in a java filter and added back to the response  </p>
  
  <pre><code>response.addCookie()
  </code></pre>
  
  <p>before returning to the client node.js application. This web application is accessed using a localhost URL in the browser. After reading about cookie domain issue while using 'localhost', i did not set any domain or path in the cookie, while creating it.</p>
  
  <p>Now the Chrome or Firefox browsers don't show-up the cookie in the browser. All my URLs are <a href="http://localhost" rel="nofollow">http://localhost</a> but, each page having different path. </p>
  
  <p>Step 1: During a request to <a href="http://localhost/app/login" rel="nofollow">http://localhost/app/login</a> cookie is created and set in the response  <br>
  Step 2: When the page loads after response, no cookies are shown in Chrome <br>
  Step 3: During the next request <a href="http://localhost/app/customer" rel="nofollow">http://localhost/app/customer</a> the previously created cookie is not recieved when trying request.getCookies(). <br>
  Step 4: Before returning back to client application, a cookie is created <br>
  Step 5: Now the cookie created in Step 4 is shown in Chrome <br>
  Step 6: The next request is also sent to <a href="http://localhost/app/customer" rel="nofollow">http://localhost/app/customer</a> , now the cookie created in step 4 is recieved in the server as well <br></p>
  
  <p><strong><em>If cookie creation for localhost is an issue, how does it work for Steps 4-6 only ?</em></strong> </p>
  
  <blockquote>
    <p>How can i make the created cookie available to all paths under the
    localhost domain ? I tried using cookie.addPath("/") but, no change.</p>
  </blockquote>
  
  <p><strong><em>Note</em></strong>: Due to admin privilege issues in my development machine, i am not able to set-up a domain name to my localhost IP in etc/hosts file. </p>