Milo and EDS link transformation - Bacom link typo http vs https #3273
Replies: 3 comments 2 replies
-
Hi @mokimo , @overmyheadandbody, and @janaki-r-bhagwath would love your thoughts on the above! Thank you, |
Beta Was this translation helpful? Give feedback.
-
I don't have any context of why we do this, but context on links in general... EDS turns all links into relative ones, however we do alter some links, for specific use-cases. To my mind come links using 'federal' where we never want a relative but a fully qualified link to consume the centralized content. I'm generally a bit cautious about changing this logic, because it will lead to a long tail of issues and I'm 99% sure of this, because most of this logic is there for some use-case.... However, we always happily accept PRs 😁 @robert-bogos do you have any feedback, considering you lately shipped a bigger feature for link transformation looking at various use-cases? |
Beta Was this translation helpful? Give feedback.
-
@JasonHowellSlavin My take on this would to be to solve it by adding a preflight check for HTTP links. |
Beta Was this translation helpful? Give feedback.
-
Hello community,
During a release our authors accidentally added links with
http
instead ofhttps
. Because of the way Milo and EDS process links, this slipped through both Preflight and preview for our authors, and links withhttp
leading to preview content made it to production.However, I think we can prevent this issue by updating our
localizeLink
function to no longer "process" links to make them relative. After we do this, I have been asked to add a check for HTTP to Preflight, and Preflight could catch the issue.First, it appears that EDS already localizes links based on the origin, as seen in this page source:
![Screen Shot 2024-11-27 at 9 43 38 AM](https://private-user-images.githubusercontent.com/17607967/390545319-a5162ed0-e6a4-4b70-bead-9389f0fc6d5b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTUyNDEsIm5iZiI6MTczOTA1NDk0MSwicGF0aCI6Ii8xNzYwNzk2Ny8zOTA1NDUzMTktYTUxNjJlZDAtZTZhNC00YjcwLWJlYWQtOTM4OWYwZmM2ZDViLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyNDkwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM2ZDkwMDBmMTYwYjA5YmJlNzljZTQ0NTQ2YTc3MmEzZGE2NzZhZTZlNDZmZjk0ZTBiMzgyYjAyZGExNTA3OWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.C08ztNl3LWA8_i5UEwCppzPkf2W6c-5FMzxetqDKA_A)
You can see that the fragments, etc. all are localized. If you compare with this screenshot:
![Screen Shot 2024-11-27 at 11 37 56 AM](https://private-user-images.githubusercontent.com/17607967/390545774-f328f3cf-9323-449e-a135-f70143cf19d2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTUyNDEsIm5iZiI6MTczOTA1NDk0MSwicGF0aCI6Ii8xNzYwNzk2Ny8zOTA1NDU3NzQtZjMyOGYzY2YtOTMyMy00NDllLWExMzUtZjcwMTQzY2YxOWQyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyNDkwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRjNzUzMmNhNzY2NWQ1MTA1NTYyZThiN2QyOTQ4MThiNzNlYjMwNzU3NjhiOGE0OGU3ZDAxZThmMmM1M2U3NWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Owde9x7y4t5gwU6R2JxGS42bGVpVoAL6l22cey_mlWs)
On line 88 you can see that a url with a
/fragment/
path was made relative even though authored with an origin, but the link after it in the span,https://business.adobe.com
was not made relative. The fragment is authored with ahlx.page
url, theb.a.com
url is authored as a fully qualifiedb.a.com
url and is not made relative by EDS.The bug occurred for our authors because when we run
localizeLink
, Milo checks by hostname and then if it finds the hostnames are the same it removes all but the path. However, checking by hostname omits HTTP|S which caused our bug. It also seems to me that it may be redundant as EDS makes links relative as well. As far as I can tell, EDS checks for EDS origins including the HTTPS (EDS seems to make relative bothpage
andlive
links regardless of which environment you are viewing).When our authors were authoring the pages, they were previewing on
hlx.page
, and because the hostname matched, Milo made the link with HTTP relative, showing no issue. However, when moving to production, the hostname and origins did not match, so EDS and Milo did not modify the links, making it so that HTTP links were on the production pages.Can we remove the code that modifies the link? Is there a reason why we make links with matching hostnames relative when EDS does so if the origin matches? If we could remove it, that block of code could be simplified greatly I think.
Beta Was this translation helpful? Give feedback.
All reactions