Repository navigation
Description
Description
Internal link navigation on archived Shopify storefronts can enter an infinite redirect loop during replay.
The affected pages contain Shopify's inline exit-interstitial.js. This script uses the browser Navigation API and reads NavigateEvent.destination.url to decide whether a navigation is external. During replay, that property exposes the technical replay URL instead of the original archived URL. Shopify therefore treats an internal link as external and wraps it in its /url?q=... exit-interstitial route. Each resulting navigation is wrapped again, causing an exponentially growing URL.
This was reproduced with multiple Shopify storefront archives.
Environment
- ReplayWeb.page: 2.5.4
- wabac.js: 2.27.4
- Archive format: WACZ
- Capture software: Browsertrix Crawler 1.14.x
- Replay tested in both the desktop application and a locally served ReplayWeb.page 2.5.4 build
Steps to reproduce
-
Capture a Shopify storefront that includes Shopify's inline
exit-interstitial.jsand at least one internal link, for example:<a href="/pages/contact">Contact</a>
-
Open the resulting WACZ in ReplayWeb.page 2.5.4.
-
Open the archived storefront start page.
-
Click the internal
Contactlink.
A minimized synthetic generated WACZ using shop.example is attached:
synthetic-wacz.zip
Expected behavior
Replay navigates to:
https://shop.example/pages/contact
Actual behavior
Replay enters a loop whose URL grows continuously, following this pattern:
https://shop.example/url?q=http%3A%2F%2Flocalhost%3APORT%2Fw%2FCOLLECTION%2F...%2Fhttps%3A%2F%2Fshop.example%2Fpages%2Fcontact&trigger=navigate
The next navigation wraps the complete replay URL again in another /url?q=..., and this repeats until replay fails or the URL becomes extremely large.
Entering https://shop.example/pages/contact directly in the ReplayWeb.page URL field works correctly.
Diagnostic findings
The archive itself appears complete:
- The target page is present in the WACZ and replays successfully when opened directly.
- The raw archived HTML contains a normal relative link such as
/pages/contact. - Neither
/url?q=nor the replay hostname occurs in the raw WARC response records.
Immediately before clicking the link, the replayed document reports values equivalent to:
anchor.getAttribute("href") = "/pages/contact"
anchor.href = "https://shop.example/pages/contact"
WB_wombat_location.origin = "https://shop.example"
window.location.origin = "http://localhost:PORT"
Shopify's exit-interstitial.js registers a handler using the Navigation API. A simplified equivalent of the relevant behavior is:
const originalOrigin = location.origin;
navigation.addEventListener("navigate", (event) => {
const destination = new URL(event.destination.url);
if (destination.origin !== originalOrigin) {
event.preventDefault();
location.assign(
`/url?q=${encodeURIComponent(destination.href)}&trigger=navigate`,
);
}
});During replay, event.destination.url returns a value equivalent to:
http://localhost:PORT/w/COLLECTION/.../https://shop.example/pages/contact
instead of:
https://shop.example/pages/contact
The replay origin is therefore misclassified as an external destination by the archived script.
Likely cause
Wombat rewrites common URL-bearing DOM properties, but it does not currently appear to handle the Navigation API's NavigationDestination.url property. A source search did not find handling for NavigationDestination or NavigateEvent.
Suggested direction
Please consider exposing the original archived URL through NavigationDestination.prototype.url, using the same URL extraction behavior already used for other URL-bearing browser APIs.
Conceptually, this may be similar to applying Wombat's existing URL-property extraction logic to:
NavigationDestination.prototype.urlAn implementation should preserve the normal browser Navigation API behavior while returning the original URL to archived page scripts.
Verified temporary workaround
As a diagnostic test, a script was injected before the archived page and prevented only the navigate handler registration originating from exit-interstitial.js. With that single handler suppressed, clicking the same internal link navigated correctly to:
https://shop.example/pages/contact
No WACZ content was modified for this test. This confirms that the captured content is present and that the loop is caused by the interaction between the Navigation API destination URL and Shopify's exit-interstitial logic.
Activity