Home > Net >  How to set HostOnly on a cookie?
How to set HostOnly on a cookie?

Time:11-22

I am using a CookieSerializer and I am trying to set HostOnly to this cookie but I can't find anything related to this.

The column HostOnly I can see just in Firefox inspect. Not available in Safari or in Google Chrome.

This is how my cookie is defined:

 DefaultCookieSerializer serializer = new DefaultCookieSerializer();
    serializer.setCookieName("M_SESSION");
    serializer.setCookiePath("/");
    serializer.setDomainNamePattern("^((\\w \\.) \\w \\.[a-z] )$");
    serializer.setUseHttpOnlyCookie(true);
    return serializer;

Any advice how to do this?

CodePudding user response:

In your case removing "serializer.setDomainNamePattern("^((\w \.) \w \.[a-z] )$");" should solve your issue.

  • Related