Smoke test a new origin

Send a copy of your traffic to a test origin before returning a response from production.


Use this solution in your VCL service (click RUN below to test this solution or clone it to make changes):


Use this solution in your Compute@Edge service:

  1. Rust
// Clone the request so we can send a copy to each backend. Note that this is potentially
// expensive for large bodies, as the body must be buffered.
let req_test = req_production.clone_with_body();
// Send an asynchronous request to production and test backends
let pending_req_production = req_production.send_async(BACKEND_PRODUCTION)?;
let pending_req_test = req_test.send_async(BACKEND_TEST)?;
// Wait for the responses from each backend
let resp_production = pending_req_production.wait()?;
let resp_test = pending_req_test.wait()?;
let is_same_status = resp_production.get_status() == resp_test.get_status();
let is_same_content_len =
resp_production.get_content_length() == resp_test.get_content_length();
if is_same_status && is_same_content_len {
log::info!("Prod and test are the same");
} else {
log::info!("The production and test environments returned different content");