Skip to content

Commit 56920c9

Browse files
permutive full config
1 parent cdd52a3 commit 56920c9

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

crates/js/lib/src/ext/permutive.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,25 @@ declare const permutive: {
4444
};
4545

4646
export function installPermutiveShim() {
47+
log.info('Installing Permutive shim - rewriting API hosts to first-party domain');
4748

49+
const host = window.location.host;
50+
const protocol = window.location.protocol === "https:" ? "https" : "http";
4851

52+
permutive.config.apiHost = host + '/permutive/api';
53+
permutive.config.apiProtocol = protocol;
4954

50-
permutive.config.apiHost = window.location.host + '/permutive/api';
51-
permutive.config.apiProtocol = window.location.protocol === "https:" ? "https" : "http";
55+
permutive.config.secureSignalsApiHost = host + '/permutive/secure-signal';
5256

53-
permutive.config.secureSignalsApiHost = window.location.host + '/permutive/secure-signal';
57+
permutive.config.segmentSyncApiHost = host + '/permutive/sync';
58+
59+
permutive.config.cdnBaseUrl = host + '/permutive/cdn';
60+
permutive.config.cdnProtocol = protocol;
61+
62+
log.info('Permutive shim installed', {
63+
apiHost: permutive.config.apiHost,
64+
secureSignalsApiHost: permutive.config.secureSignalsApiHost,
65+
segmentSyncApiHost: permutive.config.segmentSyncApiHost,
66+
cdnBaseUrl: permutive.config.cdnBaseUrl,
67+
});
5468
}

trusted-server.toml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,28 @@ rewrite_scripts = true
6363
prefix = "/permutive/api"
6464
target = "https://api.permutive.com"
6565
methods = ["GET", "POST"]
66-
description = "Permutive API"
66+
description = "Permutive API - Configuration & segment updates"
6767

6868
[[proxy_mappings]]
6969
prefix = "/permutive/secure-signal"
7070
target = "https://secure-signals.permutive.app"
7171
methods = ["GET", "POST"]
7272
description = "Permutive Secure Signals"
73+
74+
[[proxy_mappings]]
75+
prefix = "/permutive/events"
76+
target = "https://events.permutive.app"
77+
methods = ["GET", "POST"]
78+
description = "Permutive Events - Event collection endpoint"
79+
80+
[[proxy_mappings]]
81+
prefix = "/permutive/sync"
82+
target = "https://sync.permutive.com"
83+
methods = ["GET", "POST"]
84+
description = "Permutive Sync - Identity synchronization"
85+
86+
[[proxy_mappings]]
87+
prefix = "/permutive/cdn"
88+
target = "https://cdn.permutive.com"
89+
methods = ["GET"]
90+
description = "Permutive CDN - Static assets"

0 commit comments

Comments
 (0)