Module fastly::limits

source ·
👎Deprecated since 0.9.11: Wasm-based control of these limits will be removed in future versions. Fastly’s network services resource limits do and will continue to apply; see https://docs.fastly.com/en/guides/network-services-resource-limits#request-and-response-limits
Expand description

Automatically enforced limits for HTTP components.

When reading in the client request and backend responses, these limits are used to bound the size of various components of the requests and responses. When these limits are exceeded, the program will panic, returning a 400 Bad Request Error to the client.

You can modify these limits, though applications are still subject to the overall WebAssembly heap size limit.

§Examples

Changing maximum request header size

use fastly::limits::RequestLimits;
fn main() -> Result<(), Error> {
    RequestLimits::set_max_header_name_bytes(Some(128));
    RequestLimits::set_max_header_value_bytes(Some(128));
    let request = Request::from_client();

    Response::new().send_to_client();
    Ok(())
}

Changing maximum request URL size

use fastly::limits::RequestLimits;
fn main() -> Result<(), Error> {
    RequestLimits::set_max_url_bytes(Some(64));
    let request = Request::from_client();

    Response::new().send_to_client();
    Ok(())
}

Changing maximum response header size

use fastly::limits::ResponseLimits;
#[fastly::main]
fn main(request: Request) -> Result<Response, Error> {
    ResponseLimits::set_max_header_name_bytes(Some(128));
    ResponseLimits::set_max_header_value_bytes(Some(128));
    let response = request.send("example_backend")?;

    Ok(response)
}

Structs§

  • RequestLimitsDeprecated
    The limits for components of an HTTP request.
  • ResponseLimitsDeprecated
    The limits for components of an HTTP request.

Constants§