Skip to content

Commit

Permalink
fix: Remove existing Tagular cookie with outdated domain metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
julianajlk committed Nov 18, 2024
1 parent 70da326 commit a2fe92c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cohesion/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export const getCorrelationID = () => {
const COOKIE_NAME = 'tglr_correlation_id';
const PARAM_NAME = 'correlationId';

// If the tagular correlation ID cookie was set before we added the change to
// specify the domain, it was automatically added to the current domain.
// Always delete the cookie with the current domain
new Cookies().remove(COOKIE_NAME, { domain: 'payment.edx.org', path: '/' });

function getDomain() {
const { hostname } = window.location;
const parts = hostname.split('.');
Expand All @@ -29,7 +34,7 @@ export const getCorrelationID = () => {

const expirationDate = new Date();
expirationDate.setMinutes(expirationDate.getMinutes() + 30); // 30 mins expiration from now
new Cookies().set(COOKIE_NAME, paramId, { expires: expirationDate, domain: `.${getDomain()}` });
new Cookies().set(COOKIE_NAME, paramId, { expires: expirationDate, domain: `.${getDomain()}`, path: '/' });

return paramId;
};
Expand Down

0 comments on commit a2fe92c

Please sign in to comment.