Repository navigation
Conversation
Replace to_abs with normalize_creative_url and move exclusion policy to Rewrite::should_proxy_asset and Rewrite::should_wrap_click, sharing the case-insensitive proxy host matcher. Normalize exclude_domains at load. This is the shared step for #1231 and #1234. Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
…when unset Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
The rewrite pass registers asset handlers only when rewrite_creatives is on and the anchor handler only when click rewriting resolves on. Base removal and TSJS injection run whenever either is on. Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
…rty proxy Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
…avior Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
10 of 14 tasks
8 tasks
aram356
marked this pull request as draft
October 8, 2026 15:50
5 of 14 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[auction] rewrite_clickscontrols<a href>and<area href>wrapping into signed/first-party/clickredirects, andrewrite_creativesnow controls asset URLs only. Operators can keep first-party click tracking with assets left direct, or proxy assets with landing links left alone.rewrite_clicksis anOption<bool>, and unset is the default:rewrite_creatives, so no existing config changes behavior on upgrade./first-party/proxykeeps wrapping links as it does today.<base>removal and TSJS injection run when either switch is on.to_absis replaced bynormalize_creative_urlplusRewrite::should_proxy_assetandRewrite::should_wrap_click.exclude_domainsmatching is now case-insensitive and trimmed.Implements the approved design in #1249:
docs/superpowers/specs/2026-10-07-1234-creative-click-rewrite-switch-design.md.Stacked PR. The base is
spec/1234-creative-click-rewrite-switch(#1249), so this diff shows only the implementation. Merge #1249 first; GitHub then retargets this PR tomain. Usegit diff -wwhen readingcreative.rs, because gating the handlers re-indents a large block.Changes
crates/trusted-server-core/src/auction_config_types.rsrewrite_clicks: Option<bool>(left out of the blob when unset),rewrites_auction_clicks(),rewrites_proxied_clicks(), testscrates/trusted-server-core/src/creative.rsnormalize_creative_url,asset_target/click_target,CreativeFeatures. Asset and anchor handlers are registered only when their switch is on. Caller wiring, module docs, the four-combination matrix tests, and a byte-for-byte pin againstmain's outputcrates/trusted-server-core/src/settings.rsRewrite::should_proxy_asset,should_wrap_clickandnormalize(trim, lowercase, drop inert entries); removesis_excluded; testscrates/trusted-server-core/src/proxy.rs/first-party/signuses the normalizer and policy; proxied-HTML click testscrates/trusted-server-core/src/config_payload.rscrates/trusted-server-core/src/auction/formats.rs,publisher.rs/auctionand inline tests; doc and log updatescrates/trusted-server-core/src/auction/orchestrator.rsAuctionConfigliteralcrates/trusted-server-core/src/auction/endpoints.rs,auction/README.mdcrates/trusted-server-cli/tests/config_env_overlay.rsTRUSTED_SERVER__AUCTION__REWRITE_CLICKSoverride behavior, with and without the TOML leaftrusted-server.example.tomlrewrite_creativescomment narrowed to assets; commented-outrewrite_clicksline with rollout notesdocs/guide/configuration.md,creative-processing.md,auction-orchestration.md,api-reference.mdclickGuardvsrewrite_clicks, rollout and rollbackCHANGELOG.mdrewrite_clicks; Fixed case-insensitiveexclude_domainsand the related edge casesCloses
Closes #1234
Test plan
cargo test-fastly && cargo test-axum. Alsocargo test-fastly-reuse,cargo test-cloudflare,cargo test-spin,./scripts/test-cli.shand the parity tests.cargo clippy-fastly && cargo clippy-axum. All 8 clippy aliases pass, and every intermediate commit passesclippy-fastly.cargo fmt --all -- --checkcd crates/trusted-server-js/lib && npx vitest run(no JS changes)cd crates/trusted-server-js/lib && npm run format(no JS changes)cd docs && npm run format, plus the markdown prettier check outsidedocs/cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute serveRollout: deploy the binary first; behavior is unchanged while
rewrite_clicksis unset. Then push a config that sets it. Rollback: remove any explicitrewrite_clicksand push first, then roll back the binary.Checklist
unwrap()in production code — useexpect("should ...")tracingmacros (notprintln!)