Skip to content

Commit 47dd910

Browse files
committed
Added logging for synthetic ID handling in proxy mode; updated .env.dev for local testing.
1 parent 973c2c1 commit 47dd910

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

crates/common/src/proxy.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,7 @@ pub async fn handle_first_party_click(
265265
had_params,
266266
} = reconstruct_and_validate_signed_target(settings, req.get_url_str())?;
267267

268-
let mut redirect_target = full_for_token.clone();
269-
if let Some(synthetic_id) = match get_synthetic_id(&req) {
268+
let synthetic_id = match get_synthetic_id(&req) {
270269
Ok(id) => id,
271270
Err(e) => {
272271
log::warn!(
@@ -275,15 +274,18 @@ pub async fn handle_first_party_click(
275274
);
276275
None
277276
}
278-
} {
277+
};
278+
279+
let mut redirect_target = full_for_token.clone();
280+
if let Some(ref synthetic_id_value) = synthetic_id {
279281
match url::Url::parse(&redirect_target) {
280282
Ok(mut url) => {
281283
let mut pairs: Vec<(String, String)> = url
282284
.query_pairs()
283285
.filter(|(k, _)| k.as_ref() != "synthetic_id")
284286
.map(|(k, v)| (k.into_owned(), v.into_owned()))
285287
.collect();
286-
pairs.push(("synthetic_id".to_string(), synthetic_id));
288+
pairs.push(("synthetic_id".to_string(), synthetic_id_value.clone()));
287289

288290
url.set_query(None);
289291
if !pairs.is_empty() {
@@ -320,18 +322,14 @@ pub async fn handle_first_party_click(
320322
.get_header(HEADER_REFERER)
321323
.and_then(|h| h.to_str().ok())
322324
.unwrap_or("");
323-
let potsi = req
324-
.get_header(crate::constants::HEADER_SYNTHETIC_TRUSTED_SERVER)
325-
.and_then(|h| h.to_str().ok())
326-
.unwrap_or("");
327325
log::info!(
328-
"click: redirect tsurl={} params_present={} target={} referer={} ua={} potsi={}",
326+
"click: redirect tsurl={} params_present={} target={} referer={} ua={} synthetic_id={}",
329327
tsurl,
330328
had_params,
331329
full_for_token,
332330
referer,
333331
ua,
334-
potsi
332+
synthetic_id.as_deref().unwrap_or("")
335333
);
336334

337335
// 302 redirect to target URL

0 commit comments

Comments
 (0)