adobe / adobe/aem-core-wcm-components

Log spam from Embed - Invalid cookie header - Invalid 'expires' attribute

Open
#2,835 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
795
Forks
775
Avg merge
3d 22h
Merged PRs (30d)
8

Description

Bug Present as of Version: 2.25.5-SNAPSHOT

When using a twitter embed, logs get spammed with a bunch of warnings about invalid expires header on cookies.

```
08.08.2024 16:33:30.592 *WARN* [[0:0:0:0:0:0:0:1] [1723152810209] GET /content/mysite/embed-url/_jcr_content/root/container-bodywrapper/container/container/showcase/embed_623053893.urlProcessor.json HTTP/1.1] org.apache.http.client.protocol.ResponseProcessCookies Invalid cookie header: "set-cookie: guest_id_marketing=v1%3A172315281055025185; Max-Age=63072000; Expires=Sat, 08 Aug 2026 21:33:30 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None". Invalid 'expires' attribute: Sat, 08 Aug 2026 21:33:30 GMT
08.08.2024 16:33:30.592 *WARN* [[0:0:0:0:0:0:0:1] [1723152810209] GET /content/mysite/embed-url/_jcr_content/root/container-bodywrapper/container/container/showcase/embed_623053893.urlProcessor.json HTTP/1.1] org.apache.http.client.protocol.ResponseProcessCookies Invalid cookie header: "set-cookie: guest_id_ads=v1%3A172315281055025185; Max-Age=63072000; Expires=Sat, 08 Aug 2026 21:33:30 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None". Invalid 'expires' attribute: Sat, 08 Aug 2026 21:33:30 GMT
08.08.2024 16:33:30.592 *WARN* [[0:0:0:0:0:0:0:1] [1723152810209] GET /content/mysite/embed-url/_jcr_content/root/container-bodywrapper/container/container/showcase/embed_623053893.urlProcessor.json HTTP/1.1] org.apache.http.client.protocol.ResponseProcessCookies Invalid cookie header: "set-cookie: personalization_id="v1_rhyixvZDOy/LXsJArmPB6A=="; Max-Age=63072000; Expires=Sat, 08 Aug 2026 21:33:30 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None". Invalid 'expires' attribute: Sat, 08 Aug 2026 21:33:30 GMT
08.08.2024 16:33:30.592 *WARN* [[0:0:0:0:0:0:0:1] [1723152810209] GET /content/mysite/embed-url/_jcr_content/root/container-bodywrapper/container/container/showcase/embed_623053893.urlProcessor.json HTTP/1.1] org.apache.http.client.protocol.ResponseProcessCookies Invalid cookie header: "set-cookie: guest_id=v1%3A172315281055025185; Max-Age=63072000; Expires=Sat, 08 Aug 2026 21:33:30 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None". Invalid 'expires' attribute: Sat, 08 Aug 2026 21:33:30 GMT
```

Seems like a somewhat common issue: https://stackoverflow.com/questions/36473478/fixing-httpclient-warning-invalid-expires-attribute-using-fluent-api

Can fix this by updating `com.adobe.cq.wcm.core.components.internal.services.embed.OEmbedClientImpl#getHttpClient`

from
```
RequestConfig rc = RequestConfig.custom()
.setConnectTimeout(config.connectionTimeout())
.setSocketTimeout(config.socketTimeout())
.build();
```
to
```
RequestConfig rc = RequestConfig.custom()
.setConnectTimeout(config.connectionTimeout())
.setSocketTimeout(config.socketTimeout())
.setCookieSpec(CookieSpecs.STANDARD) // add this
.build();
```

Contributor guide

Open the contributing guide

Research direction

Start in com.adobe.cq.wcm.core.components.internal.services.embed.OEmbedClientImpl#getHttpClient and reproduce the Twitter embed request that emits the invalid expires warnings. Verify that the HTTP client uses the requested cookie handling and that the log spam no longer occurs when processing the embed response.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.