adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
746 stars 753 forks source link

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

Open HitmanInWis opened 3 months ago

HitmanInWis commented 3 months ago

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();
HitmanInWis commented 3 months ago

A similar update should likely be made to com.adobe.cq.wcm.core.components.internal.form.FormHandlerImpl#activate