Cookie is not set on localhost in chrome or firefox : <p>I am working with a Jersey server which returns a cookie in the following way:</p>

<pre><code>return Response.ok()
    .cookie(
        new NewCookie(
            "userAccessToken", userTokenDTO.getToken(), "/", "", 
            "what is this", 3600, false
        )
    ).build();
</code></pre>

<p>When I call the method which returns the cookie, I get the following result in chrome:
<a href="https://i.stack.imgur.com/UuCq2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UuCq2.png" alt="Request and response headers"></a></p>

<p>I can even see that chrome has recognized my cookie:
<a href="https://i.stack.imgur.com/4gHxt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4gHxt.png" alt="Cookie recognized"></a></p>

<p>But for some reason it isn't set in the cookie tab:</p>

<p><a href="https://i.stack.imgur.com/9Tx4K.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9Tx4K.png" alt="No cookie shown"></a></p>

<p>I have tried setting the domain both to false, null, "", creating an entry in the hosts file renaming 127.0.0.1.</p>

<pre><code>return Response.ok()
    .cookie(
            new NewCookie(
                    "userAccessToken", userTokenDTO.getToken(), "/", "127.0.0.1",
                    "what is this", 3600, false)
    ).build();
</code></pre>

<p>Works in IE 11, but still not Chrome nor Firefox...</p>

<p>I have tried multiple time to insert another host name for 127.0.0.1. In this example it is text.myexample.com. It still doesn't work in any other browser than IE11. </p>

<pre><code>return Response.ok()
    .cookie(
            new NewCookie(
                    "userAccessToken", userTokenDTO.getToken(), "/", "test.myexample.com",
                    "what", 7200, false)
    ).build();
</code></pre>

<p>I tried to do the following in the console of Google Chrome:</p>

<pre><code>document.cookie = "userAccessToken=72bebbe0-44fd-45ce-a6e1-accb72201eff;Version=1;Comment=what;Domain=test.myexample.com;Path=/;Max-Age=7200"
</code></pre>

<p>Which is the cookie in the header returned by the server in Chrome. That works fine. I have literally no clue what is going on here.</p>
