1 Reply Latest reply on Sep 21, 2018 5:00 AM by fregnaut1

    Cookie path setting seemed ignored

    fregnaut1

      Since Wildfly 11, when I set the cookie path of my own cookie (not the session one), it seemed ignored : The cookie is created, but with the 'default path' corresponding to the web-app path

       

      I set the cookie path in java with this simple code : 

       

      Cookie cookie = new Cookie(cookieName, value);

      cookie.setMaxAge(expiryTime); 

      cookie.setPath("/mypath; HttpOnly");

       

      But my cookie is created with the default path of the web-app

       

      Is it a new setting , something i can change ?

        • 1. Re: Cookie path setting seemed ignored
          fregnaut1

          Last minute !

           

          I found the problem,  it was in my code :

          cookie.setPath("/mypath; HttpOnly");

           

          This worked ok with javax.servlet 2.5.

           

          But, wildfly 11+ must use javax.servlet 3.0 and there's now a separate property for the httpOnly option

           

          So the code becomes now

          cookie.setPath("/mypath"); 

          cookie.setHttpOnly(true);

          and it works as expected !