Skip to content

Commit 45f895a

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix-sourcepoint-publicpath-404
# Conflicts: # crates/trusted-server-core/src/integrations/datadome.rs # crates/trusted-server-core/src/integrations/gpt.rs # crates/trusted-server-core/src/integrations/lockr.rs # crates/trusted-server-core/src/integrations/permutive.rs # crates/trusted-server-core/src/integrations/sourcepoint.rs
2 parents 140ccd6 + bc54caa commit 45f895a

5 files changed

Lines changed: 21 additions & 1 deletion

File tree

crates/trusted-server-core/src/integrations/datadome.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
//! automatically rewrite `DataDome` script URLs in HTML responses:
5353
//!
5454
//! - `<script src="https://js.datadome.co/tags.js">` becomes
55-
//! `<script src="https://publisher.com/integrations/datadome/tags.js">`
55+
//! `<script src="/integrations/datadome/tags.js">`
5656
//! - Handles both `src` and `href` attributes (for preload/prefetch links)
5757
5858
use std::sync::{Arc, LazyLock};
@@ -815,6 +815,10 @@ impl IntegrationAttributeRewriter for DataDomeIntegration {
815815

816816
let path = Self::extract_datadome_path(attr_value);
817817
// Root-relative so the browser resolves it against the page host.
818+
// Note: a page-level `<base href>` participates in this resolution, so
819+
// on pages that set an external base URL these resolve against that base
820+
// rather than the address-bar origin — an accepted tradeoff, matching
821+
// GTM/Didomi/Testlight which are also relative.
818822
let new_url = format!("/integrations/datadome{path}");
819823

820824
log::info!(

crates/trusted-server-core/src/integrations/gpt.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,10 @@ impl IntegrationAttributeRewriter for GptIntegration {
443443

444444
if Self::is_gpt_script_url(attr_value) {
445445
// Root-relative so the browser resolves it against the page host.
446+
// Note: a page-level `<base href>` participates in this resolution,
447+
// so on pages that set an external base URL these resolve against
448+
// that base rather than the address-bar origin — an accepted
449+
// tradeoff, matching GTM/Didomi/Testlight which are also relative.
446450
AttributeRewriteAction::replace("/integrations/gpt/script".to_string())
447451
} else {
448452
AttributeRewriteAction::keep()

crates/trusted-server-core/src/integrations/lockr.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ impl IntegrationAttributeRewriter for LockrIntegration {
420420

421421
if self.is_lockr_sdk_url(attr_value) {
422422
// Root-relative so the browser resolves it against the page host.
423+
// Note: a page-level `<base href>` participates in this resolution,
424+
// so on pages that set an external base URL these resolve against
425+
// that base rather than the address-bar origin — an accepted
426+
// tradeoff, matching GTM/Didomi/Testlight which are also relative.
423427
let replacement = "/integrations/lockr/sdk".to_string();
424428
log::debug!("Rewriting Lockr SDK URL to {}", replacement);
425429
AttributeRewriteAction::Replace(replacement)

crates/trusted-server-core/src/integrations/permutive.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,10 @@ impl IntegrationAttributeRewriter for PermutiveIntegration {
434434
if self.is_permutive_sdk_url(attr_value) {
435435
// Rewrite to first-party SDK endpoint.
436436
// Root-relative so the browser resolves it against the page host.
437+
// Note: a page-level `<base href>` participates in this resolution,
438+
// so on pages that set an external base URL these resolve against
439+
// that base rather than the address-bar origin — an accepted
440+
// tradeoff, matching GTM/Didomi/Testlight which are also relative.
437441
AttributeRewriteAction::replace("/integrations/permutive/sdk".to_string())
438442
} else {
439443
AttributeRewriteAction::keep()

crates/trusted-server-core/src/integrations/sourcepoint.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ impl SourcepointIntegration {
355355
.unwrap_or_default();
356356

357357
// Root-relative so the browser resolves it against the page host.
358+
// Note: a page-level `<base href>` participates in this resolution, so
359+
// on pages that set an external base URL these resolve against that base
360+
// rather than the address-bar origin — an accepted tradeoff, matching
361+
// GTM/Didomi/Testlight which are also relative.
358362
Some(format!("{SOURCEPOINT_CDN_PREFIX}{path}{query}"))
359363
}
360364

0 commit comments

Comments
 (0)