Preflighting for flags

Park request, make a different request first, use the response to annotate the real origin request (or make decisions about how to route it).

VCL

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

Compute@Edge

Use this solution in your Compute@Edge service:

  1. Rust
// send a preflight request first
let preflight_resp = Request::get("/response-headers?Flags=group-A,new-header,search-enabled")
.send(PREFLIGHT_BACKEND)?;
// now send the original req to content backend
// add flags header if received in previous response
if let Some(flags) = preflight_resp.get_header("flags") {
req.set_header("flags", flags);
}
let beresp = req.send(MAIN_BACKEND)?;
Ok(beresp)