Skip to content

Commit fa46599

Browse files
permutive full config
1 parent dc0fee3 commit fa46599

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
@@ -47,10 +47,28 @@ X-Custom-Header = "custom header value"
4747
prefix = "/permutive/api"
4848
target = "https://api.permutive.com"
4949
methods = ["GET", "POST"]
50-
description = "Permutive API"
50+
description = "Permutive API - Configuration & segment updates"
5151

5252
[[proxy_mappings]]
5353
prefix = "/permutive/secure-signal"
5454
target = "https://secure-signals.permutive.app"
5555
methods = ["GET", "POST"]
5656
description = "Permutive Secure Signals"
57+
58+
[[proxy_mappings]]
59+
prefix = "/permutive/events"
60+
target = "https://events.permutive.app"
61+
methods = ["GET", "POST"]
62+
description = "Permutive Events - Event collection endpoint"
63+
64+
[[proxy_mappings]]
65+
prefix = "/permutive/sync"
66+
target = "https://sync.permutive.com"
67+
methods = ["GET", "POST"]
68+
description = "Permutive Sync - Identity synchronization"
69+
70+
[[proxy_mappings]]
71+
prefix = "/permutive/cdn"
72+
target = "https://cdn.permutive.com"
73+
methods = ["GET"]
74+
description = "Permutive CDN - Static assets"

0 commit comments

Comments
 (0)