Skip to content

feat: make integration proxy paths configurable per customer#759

Open
vasujain00 wants to merge 2 commits into
IABTechLab:mainfrom
vasujain00:feat/741-configurable-proxy-paths
Open

feat: make integration proxy paths configurable per customer#759
vasujain00 wants to merge 2 commits into
IABTechLab:mainfrom
vasujain00:feat/741-configurable-proxy-paths

Conversation

@vasujain00

@vasujain00 vasujain00 commented Jun 8, 2026

Copy link
Copy Markdown

Fixes #741

Summary

  • Adds a proxy_prefix() method to the IntegrationProxy trait allowing integrations to use customer-configured paths instead of hardcoded /integrations/{name} paths
  • Implements configurable proxy_path for the Didomi integration as the first adopter
  • Backwards-compatible: default behavior unchanged when proxy_path is not set

Changes

File Change
crates/trusted-server-core/src/integrations/registry.rs Added proxy_prefix() method to IntegrationProxy trait; updated get(), post(), put(), delete(), patch() helpers to use it
crates/trusted-server-core/src/integrations/didomi.rs Added proxy_path config field; overrides proxy_prefix() when set; updated routes and path stripping

Closes

Closes #741

Test plan

  • cargo test --workspace
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • JS tests: cd crates/js/lib && npx vitest run
  • JS format: cd crates/js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: New test registers_custom_proxy_path verifies custom path routes correctly and default path no longer matches

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code -- use expect("should ...")
  • Uses tracing macros (not println!)
  • New code has tests
  • No secrets or credentials committed

@vasujain00 vasujain00 marked this pull request as draft June 8, 2026 19:21
@vasujain00 vasujain00 marked this pull request as ready for review June 8, 2026 19:21

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution — making these proxy paths configurable is a good direction, and I appreciate that the default route behavior is covered. I found two implementation gaps that look worth addressing before relying on custom Didomi paths.

I left the main items inline. One additional follow-up: once the behavior is wired through, please update docs/guide/integrations/didomi.md to document proxy_path, its default, accepted format, and the custom endpoint examples.

Comment thread crates/trusted-server-core/src/integrations/didomi.rs
Comment thread crates/trusted-server-core/src/integrations/didomi.rs Outdated
@vasujain00 vasujain00 force-pushed the feat/741-configurable-proxy-paths branch from 694d607 to 6c287b3 Compare June 10, 2026 17:50
Vasu Jain added 2 commits June 11, 2026 16:56
Fixes IABTechLab#741

Adds a `proxy_prefix()` method to the `IntegrationProxy` trait with a
default implementation that preserves existing behavior
(`/integrations/{name}`). Integrations can override this to use a
customer-configured path that is harder for ad blockers to target.

Implements the feature for the Didomi integration as the first example:

  [integrations.didomi]
  proxy_path = "my-custom-consent-path"

When `proxy_path` is set, routes are registered under
`/<proxy_path>/*` instead of the default
`/integrations/didomi/consent/*`. The same pattern can be adopted by
other integrations.

This is a backwards-compatible change -- if `proxy_path` is not set,
the default prefix is used and existing deployments are unaffected.
1. Validate proxy_path at config load time:
   - Reject empty, trailing slash, double slash, and matchit
     metacharacters ({, }, *, ?, #, space)
   - Uses validator crate custom function (runs automatically
     via Settings::integration_config)
   - Added 5 validation unit tests

2. Pass custom proxy path to client-side JS:
   - Implement IntegrationHeadInjector for DidomiIntegration
   - Injects window.__tsjs_didomi={proxyPath:"/..."}
   - TypeScript reads from window.__tsjs_didomi?.proxyPath,
     falls back to default /integrations/didomi/consent/
   - Existing Didomi JS tests still pass (318 total)

3. Document proxy_path in docs/guide/integrations/didomi.md:
   - Added to Configuration Options table
   - New 'Custom Proxy Path' section with format rules, examples
   - Added environment variable equivalent
@ChristianPavilonis ChristianPavilonis force-pushed the feat/741-configurable-proxy-paths branch from 6c287b3 to ea3c6b8 Compare June 11, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make integration proxy paths configurable per customer

2 participants