I tried this
Solved! Go to Solution.
The reason why externalizer.absoluteLink is returning an HTTP URL instead of HTTPS could be due to AEM running behind a reverse proxy or load balancer, or not being configured to support HTTPS. To resolve this, you need to check your AEM configuration to determine the cause of the issue and take the necessary steps to configure AEM correctly.
You need to enable SSL for local AEM Server to make local run on https instead of http. Also its not ideal to use absoluteLink. Its overloaded methods are deprecated in favor of externalizer.externalLink(). So enable SSL, use externalLink and check if it solves.