NAME
PAGI::Middleware::Head - HEAD request handling middleware
SYNOPSIS
use PAGI::Middleware::Builder;
my $app = builder {
enable 'Head';
$my_app;
};
DESCRIPTION
PAGI::Middleware::Head handles HEAD requests by suppressing the response body while preserving all headers. The inner application runs normally (as if it were a GET request), allowing Content-Length and other headers to be calculated, but the body is not sent to the client.
This middleware changes the method from HEAD to GET before passing to the inner app, then suppresses the body in the response.
CONFIGURATION
No configuration options.
NOTES
HEAD requests are converted to GET for the inner app, so the app can calculate Content-Length normally.
The body is suppressed in the response, but headers are preserved.
This middleware should be placed BEFORE ContentLength middleware in the stack, so Content-Length is calculated from the GET response.
Trailers are also suppressed for HEAD requests.
SEE ALSO
PAGI::Middleware - Base class for middleware
PAGI::Middleware::ContentLength - Auto Content-Length header