Skip to main content
FastEdge CDN applications read and modify request and response data through the get_property and set_property host functions. The table below lists all properties accessible through this API. HTTP headers are read and written through dedicated header methods (get_http_request_header, set_http_response_header, etc.) and are not included here.

Available properties

Property pathTypeAccessAvailable inDescription
request.urlStringRead-writeon_http_request_headersOriginal URL path before modifications
request.hostStringRead-writeon_http_request_headersHost header value
request.pathStringRead-writeon_http_request_headersRequest URL path
request.schemeStringRead-onlyon_http_request_headersProtocol scheme (http or https)
request.methodStringRead-onlyon_http_request_headersHTTP method
request.extensionStringRead-onlyon_http_request_headersFile extension from the request path
request.queryStringRead-writeon_http_request_headersQuery string
request.countryStringRead-onlyon_http_request_headersTwo-letter country code, derived from client IP
request.cityStringRead-onlyon_http_request_headersCity name, derived from client IP
request.asnStringRead-onlyon_http_request_headersASN of the network associated with the client IP
request.geo.latStringRead-onlyon_http_request_headersLatitude, derived from client IP
request.geo.longStringRead-onlyon_http_request_headersLongitude, derived from client IP
request.regionStringRead-onlyon_http_request_headersRegion, derived from client IP
request.continentStringRead-onlyon_http_request_headersContinent, derived from client IP
request.country.nameStringRead-onlyon_http_request_headersCountry name, derived from client IP
nginx.log_field1StringWrite-onlyon_http_request_headersAppends a value to the CDN access log. Requires Log Uploader.
response.statusIntegerRead-onlyon_http_response_headers, on_http_response_bodyHTTP response status code
Property paths are case-sensitive. The following example reads the client country and conditionally sets the log field:
fn on_http_request_headers(&mut self, _: usize, _: bool) -> Action {
    if let Some(country) = self.get_property(vec!["request.country"]) {
        let code = String::from_utf8_lossy(&country);
        self.set_property(vec!["nginx.log_field1"], Some(code.as_bytes()));
    }
    Action::Continue
}

Custom properties

Applications can define custom properties to pass state between related hooks. For example, a property set in on_http_response_headers is readable in on_http_response_body.
Custom properties created in on_http_request_headers are not available in later hooks.
The following example marks a response as Markdown in on_http_response_headers and reads that flag in on_http_response_body:
fn on_http_response_headers(&mut self, _: usize, _: bool) -> Action {
    if let Some(content_type) = self.get_http_response_header("Content-Type") {
        if content_type.starts_with("text/plain") || content_type.starts_with("text/markdown") {
            self.set_http_response_header("Content-Length", None);
            self.set_http_response_header("Transfer-Encoding", Some("chunked"));
            self.set_http_response_header("Content-Type", Some("text/html"));
            self.set_property(vec!["response.markdown"], Some(b"true"));
        }
    }
    Action::Continue
}

fn on_http_response_body(&mut self, _: usize, _: bool) -> Action {
    if self.get_property(vec!["response.markdown"]).is_none() {
        return Action::Continue;
    }
    // convert body to HTML here
    Action::Continue
}