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
- The limits for components of an HTTP request.
- The limits for components of an HTTP request.
Constants
- The default header name size limit for
RequestLimits
andResponseLimits
. - The default header value size limit for
RequestLimits
andResponseLimits
. - The default method size limit for
RequestLimits
. - The default URL size limit for
RequestLimits
.