Security at the edge means threats are stopped before they reach your infrastructure. By implementing security logic in FastEdge workers, you can validate, filter, and block requests at the closest edge location to the user — providing the fastest possible response for legitimate traffic while protecting your origin servers.
This post looks at CORS Made Simple at the Edge — one of several security patterns available in the FastEdge Rust SDK.
What It Does
Add Cross-Origin Resource Sharing headers to your responses at the edge. Handle preflight OPTIONS requests and dynamic origin allowlisting.
Processing security logic at the edge provides several benefits: reduced latency for end users because they do not need to round-trip to your origin just to get rejected, reduced load on origin servers because only validated requests reach them, and a smaller attack surface because malicious traffic is absorbed by the edge network.
Implementation
Here is how you implement this pattern using the FastEdge Rust SDK:
Deploy
For the complete implementation with all features, including rate limiting, IP allowlists, and request transformation, clone the SDK repository and check the example:
Performance Impact
All security checks at the edge run in WebAssembly with sub-millisecond overhead. Header inspection, GeoIP lookups, and pattern matching add virtually no latency — typically 10–50µs per check. This means you can layer multiple security patterns without worrying about performance degradation.
Related articles
Subscribe to our newsletter
Get the latest industry trends, exclusive insights, and Gcore updates delivered straight to your inbox.










