proxy-wasm crate. Instead of a single request handler, a CDN application implements callbacks such as on_http_request_headers and on_http_response_headers, which the CDN runtime invokes at different stages of request processing.
Rust and Cargo are required. On Windows, also install Visual Studio Build Tools with the Desktop development with C++ workload.
Add the WebAssembly target
CDN apps compile towasm32-wasip1. Add the target once — it applies to all future builds:
Configure a project
FastEdge applications compile to WebAssembly libraries. Two changes from the Cargo defaults are needed: the output type must becdylib, and proxy-wasm must be listed as a dependency.
-
Create the library crate:
-
Replace the contents of
Cargo.toml:proxy-wasm = "0.2"provides the filter traits and theproxy_wasm::main!entry point.logis used for structured logging inside the CDN pipeline.
Verify the toolchain
A minimal filter that adds a custom request header is enough to confirm the toolchain produces a valid CDN binary. Replacesrc/lib.rs:
./target/wasm32-wasip1/release/my_cdn_app.wasm. That file can be uploaded to FastEdge as a CDN application.