Skip to content

Warning "Invalid cookie header: ... Invalid 'expires' attribute"  #2421

Description

@AlexFalappa

Describe the bug

In my application using the AWS SDK to access an S3 bucket I get in my logs several WARN messages coming from the SDK managed ApacheHttClient.

Example:

2021-04-19 14:34:27.916  WARN 1 --- [   scheduling-1] o.a.h.c.protocol.ResponseProcessCookies  : Invalid cookie header: "Set-Cookie: AWSALB=IBgdfz13kcSqIebR9wDO4YsKku18wWVpnUE3SJjeOftddRj3F53UR9JAROlBRszd0rvjkzC5++wCOOvvNbyjEydLjwUeo7VT01zlt89RgskYeAw683mPa3SLKGlM; Expires=Mon, 26 Apr 2021 14:34:27 GMT; Path=/". Invalid 'expires' attribute: Mon, 26 Apr 2021 14:34:27 GMT,
2021-04-19 14:34:27.917  WARN 1 --- [   scheduling-1] o.a.h.c.protocol.ResponseProcessCookies  : Invalid cookie header: "Set-Cookie: AWSALBCORS=IBgdfz13kcSqIebR9wDO4YsKku18wWVpnUE3SJjeOftddRj3F53UR9JAROlBRszd0rvjkzC5++wCOOvvNbyjEydLjwUeo7VT01zlt89RgskYeAw683mPa3SLKGlM; Expires=Mon, 26 Apr 2021 14:34:27 GMT; Path=/; SameSite=None; Secure". Invalid 'expires' attribute: Mon, 26 Apr 2021 14:34:27 GMT,
2021-04-19 14:34:29.969  WARN 1 --- [   scheduling-1] o.a.h.c.protocol.ResponseProcessCookies  : Invalid cookie header: "Set-Cookie: AWSALB=L4KrWVU0sxSV5e0fJm3WsK+zBQBaNrtMnUjY8TuwIIG5B2/IzLHgz4gOWcrG5xFiIkYrHZ4dnIpdiGKDsmdumeOozBFnhC8ue6pPOXFD8V2se9oBRCgQS+K0aTdB; Expires=Mon, 26 Apr 2021 14:34:29 GMT; Path=/". Invalid 'expires' attribute: Mon, 26 Apr 2021 14:34:29 GMT,
2021-04-19 14:34:29.970  WARN 1 --- [   scheduling-1] o.a.h.c.protocol.ResponseProcessCookies  : Invalid cookie header: "Set-Cookie: AWSALBCORS=L4KrWVU0sxSV5e0fJm3WsK+zBQBaNrtMnUjY8TuwIIG5B2/IzLHgz4gOWcrG5xFiIkYrHZ4dnIpdiGKDsmdumeOozBFnhC8ue6pPOXFD8V2se9oBRCgQS+K0aTdB; Expires=Mon, 26 Apr 2021 14:34:29 GMT; Path=/; SameSite=None; Secure". Invalid 'expires' attribute: Mon, 26 Apr 2021 14:34:29 GMT

The HttpClient should not emit those warnings.

Possible Solution

According to this StackOverFlow answer the warning is avoidable by using the following HttpClient configuration:

HttpClient httpClient = HttpClients.custom()
        .setDefaultRequestConfig(RequestConfig.custom()
                .setCookieSpec(CookieSpecs.STANDARD).build())
        .build();

But I haven't found a way to inject the CookieSpec configuration into the Apache HttpClient managed by the SDK.

Your Environment

  • AWS Java SDK version used: 2.15.60
  • JDK version used: OpenJDK 11
  • Operating System and version: Ubuntu Linux 18.04

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p3This is a minor priority issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions