1

I'm working on a migration from Oracle iPlanet Web Server to Apache Tomcat, on OpenShift containers. Our webapp is a Apache Struts 2.5, doesn't use Spring Framework. The problem is: for some reason, session is not working, and is not working only in Internet Explorer. Tested on Mozilla Firefox, Google Chrome and Apple Safari and it works just fine, only Internet Explorer faces the issue.

Here is my web.xml session for cookie:

<session-config>
    <session-timeout>30</session-timeout>
    <cookie-config>
        <path>/</path>
    </cookie-config>
    <tracking-mode>COOKIE</tracking-mode>
</session-config>

My webapp's URL similars to this:

http://app-external-dev-4823.appcloud-np.mycompany.com/APPExternal/

The generated cookie is this:

Set-Cookie: JSESSIONID=8A46BC24370545E9885E67D050F25984.Tomcat7-rhel7; Version=1; Path="/"; HttpOnly

I read that Internet Explorer has problems with DNS URL using _, but this is not the case.

Comparing the response header for both Google Chrome and Internet Explorer, I could not find anything awkward

Google Chrome:

Cache-control:private
Content-Language:en-US
Content-Type:text/html;charset=ISO-8859-1
Date:Fri, 18 May 2018 12:08:07 GMT
Server:
Set-Cookie:JSESSIONID=3DC79F0159A3D3324658BD0A644BDE51.Tomcat7-rhel7; Version=1; Path="/"; HttpOnly
Set-Cookie:c4a1aaf48f2245d1880a957d46993e21=8fa84cd57f198140fc034497aab55b2a; path=/; HttpOnly
Set-Cookie:np_cookie=1479619875.20480.0000; path=/
Transfer-Encoding:chunked

Internet Explorer:

Response    HTTP/1.1 200 OK
Set-Cookie  JSESSIONID=3EF94406ED000ACD13A77958B424DDEC.Tomcat7-rhel7;     Version=1; Path="/"; HttpOnly
Content-Type    text/html;charset=ISO-8859-1
Content-Language    en-GB
Transfer-Encoding   chunked
Date    Fri, 18 May 2018 12:06:36 GMT
Server  

I'm really pulling my hair out here, in big chunks. I've tried to change the domain of the cookie, the path, httponly and secure properties, with no change. It works perfectly fine running on Apache Tomcat locally, by the way.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Bruno Moreira
  • 175
  • 3
  • 15
  • IE is maybe configured to refuse cookies, check the settings. – Eugène Adell May 18 '18 at 12:27
  • I though that to, but is not the case. The app runs fine on iplanet for example. And I've tested on a bunch of other machines, from another teams, same result on IE. – Bruno Moreira May 18 '18 at 12:33
  • Try changing the `jvmRoute` on your `` element to something that does not include a hyphen `-` character. Perhaps MSIE is not happy with the cookie value for some reason. – Christopher Schultz May 18 '18 at 12:41
  • Thanks Christopher, I can't change the , we're deploying our app on OpenShift containers, and the tomcat is part of a cookbook, which I don't have access. I'll update the question to reflect this information. I've tried to change it through System.properties though, but without success. – Bruno Moreira May 18 '18 at 12:46

1 Answers1

3

This may not be the answer for the question, but due to long comment I am posting my solution here.

This was the same case with our server. That works fine in local setup but on production server this issue was there. After so much of spending time googling, for a better and reliable solution wrote new way to handle interaction between client and server. The basic idea was to create our cookie and send that cookie to the client. This will be send back again to the server for every request.


    HttpSession session = request.getSession();
    if (request.getParameter("JSESSIONID") != null) {
        Cookie userCookie = new Cookie("JSESSIONID", request.getParameter("JSESSIONID"));
        response.addCookie(userCookie);
    } else {
        String sessionId = session.getId();
        Cookie userCookie = new Cookie("JSESSIONID", sessionId);
        response.addCookie(userCookie);
    }

for more info : Session is lost and created as new in every servlet request

Aslam a
  • 750
  • 10
  • 19
  • Thanks Aslam, this pretty similar to what I had done (and forgot to answer it here), I'll mark your solution as accepted. – Bruno Moreira Sep 18 '18 at 11:57