user1187958
user1187958

Reputation: 247

Java Cookie - expires date is returning in CST timezone from java / weblogic 12c

I am using the following code to expire a cookie in a J2ee web application (java 8, weblogic 12c).

Cookie cookie = new Cookie("dgv", "");
cookie.setValue("");
cookie.setPath("/");
cookie.setMaxAge(0);
response.addCookie(cookie);

Looking at the reponse, the expires header is in the CST timezone. This is preventing IE11 from deleting that cookie since it expects dates in the GMT timezone. We are only experiencing this on our production environment. Our non prod environments return dates in GMT. Where settings can i verify? Server date is in EST.

Here is what i see in the browser:

Set-Cookie: dgv=; domain=something.org; expires=Wed, 31-Dec-1969 19:00:00 CST; path=/;HttpOnly;Secure

Upvotes: 2

Views: 549

Answers (1)

tomgeraghty3
tomgeraghty3

Reputation: 1254

In the past I've seen timezone issues with WebLogic starting with the incorrect default TimeZone. An easy way to check this is to print to logs the result of

ZoneId.systemDefault()

And see if it gives you CST or GMT. If it's wrong you can either programmatically change it or pass an environment variable

-Duser.timezone

possibly in the startWebLogic.sh(cmd) script

Worth checking the Timezone / date settings of the actual server WebLogic is installed on too.

Upvotes: 3

Related Questions