Search code examples
javaandroidhttptomcattitanium-mobile

RFC 2965: effective host name does not domain-match domain attribute


I am trying to Authenticate my Android Application against a WebService, that will maintain a session/cookie to keep the User's requests authenticated.

My Mobile Application posts a request on URL format:

subdomain.domain.com:1234/webservice/authenticate

ResponseProcessCookies: Cookie rejected: 
"BasicClientCookie[version=1,name=APP_TOKEN,domain=.subdomain.domain.com,path=/,expiry=null]".
 Domain attribute ".subdomain.domain.com" 

violates RFC 2965: effective host name does not domain-match domain attribute.


Solution

  • I got my answer after loads of googling and playing around with the code for a while. This was more of server side fix, all I had to do was to leave the "Domain" property of the Cookie as blank.

    This enables the Cookie to be valid for all the subdomains as well.

    Hope it helps someone else, looking for the answer.

    If you need more clarification, IM me