fix: rewrite aem.page/aem.live image srcs in editor to prevent 401 errors #930
fix: rewrite aem.page/aem.live image srcs in editor to prevent 401 errors #930andreituicu wants to merge 10 commits into
Conversation
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
|
There was a problem hiding this comment.
Missing tests...
Also, .preview.da.live maps to da-ue worker. I do not see the relationship here. It feels like this worker is a place for a lot of things. If we want .preview to become a central place for our editor, I think we should make a clean worker that includes only what's needed.
|
Thank you for the review!
This was a decision in the last Helix hackathon to have the preview proxy and the UE proxy in the same worker, because they have a lot in common. They actually have more in common the differences. As with everything it is in a bit of transition phase, but essentially they both:
Probably the only essential difference in the long-run is that the UE side of that worker, injects instrumentation for the HTML that is required for the UE editor. The tests are a fair point, will add them. |
For hlx6 repos, images/videos are served through api.aem.live with Bearer auth. The previous code used content.da.live which does not serve hlx6 content. Now mirrors the approach from PR #930: detects hlx6 via isHlx6, rewrites contentUrl to the preview.da.live equivalent (same host pattern used for AEM images in the editor), and authenticates with livePreviewLogin instead of contentLogin. No binary fetch or blob URL needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
Images stored with *.aem.page or *.aem.live URLs now display correctly in the editor without triggering 401 errors.
When DA documents contain images served from AEM preview/publish hosts, the editor lacks the auth those hosts require. This PR rewrites those image URLs to their *.preview.da.live equivalent at render time via ProseMirror nodeViews — display-only, never written back to the document or synced via collab.
How Has This Been Tested?
Manually with: https://fximg--da-live--adobe.aem.live/edit#/andreituicu/da-test/mediabus
Screenshots (if appropriate):
The image with the cat is behind helix auth: https://main--da-test--andreituicu.aem.page/media_1222da127066e69ab4693b1aa98ad4cd6fdfe1fe4.jpg?width=2000&format=webply&optimize=medium
Types of changes
Checklist: