-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Check last modified of resource using helix admin APIs #11
base: main
Are you sure you want to change the base?
Conversation
const entry = { path: entryPath }; | ||
|
||
let date = await HelixAdminUtil.getLastModified(entryPath); | ||
if (date === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what case will the Hlx Admin APIs not give the lastModified, but the CloudFlare CDN will provide?
I mean, do we need this if condition?
|
||
static getLastModified = async (path) => { | ||
let lastModified = await HelixAdminUtil.getLastModifiedFromAdminAPIs(path, 'code'); | ||
if (!lastModified && lastModified === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be || ?
static helixAdminUrl = 'https://admin.hlx.page'; | ||
|
||
static getLastModified = async (path) => { | ||
let lastModified = await HelixAdminUtil.getLastModifiedFromAdminAPIs(path, 'code'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to check lastModified from .page
url?
Shouldn't we check from just .live
url?
@@ -148,6 +149,9 @@ export default class GenerateScreensOfflineResources { | |||
lastModified: new Date(lastModified) | |||
}; | |||
|
|||
const hierarchy = PathUtils.getParentHierarchy(manifestData[i].path); | |||
channelEntry.hierarchy = hierarchy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it related to this change?
What's the use of this?
Description
This is a fix for ticket SCRNS-3497
There seems to be an issue with the Cloudflare CDN. The last-modified in the franklin URLs are correct but incorrect in cloudflare CDN urls. Since we use custom domains from cloudflare, it's better to check helix admin APIs for the last modified values.
We can use helix admin APIs whichever give 200 status code to get the last modified.
https://admin.hlx.page/code/hlxscreens/sodexo/main/scripts/delayed.js
Or
https://admin.hlx.page/live/hlxscreens/sodexo/main/scripts/delayed.js
Related Issue
SCRNS-3497
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: