Set up Rust for FastEdge CDN apps by adding the wasm32-wasip1 target, configuring a Cargo project, and verifying the toolchain.
FastEdge CDN applications run inside Gcore’s CDN pipeline and can intercept HTTP traffic at four stages: on request headers, on request body, on response headers, and on response body. They are built on the Proxy-Wasm specification — an open standard for WebAssembly-based proxy extensions used across CDN and service mesh environments.In Rust, Proxy-Wasm applications use the 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.
FastEdge applications compile to WebAssembly libraries. Two changes from the Cargo defaults are needed: the output type must be cdylib, and proxy-wasm must be listed as a dependency.
Do not set request headers with the x-cdn- or x-gcdn- prefixes. The CDN reserves these names for internal use and strips them before the request reaches the origin. The Proxy-Wasm header APIs do not return an error when the application sets a reserved name, so the header appears to be set in the app but never arrives at the origin.
Build it:
cargo build --release --target wasm32-wasip1
The first build downloads dependencies and takes one to two minutes. When it completes without errors, the toolchain is ready — the compiled binary is at ./target/wasm32-wasip1/release/my_cdn_app.wasm. That file can be uploaded to FastEdge as a CDN application.