Use the $r->header_in method:
$value = $r->header_in("Header-name");
For example, suppose you want to discover the client's preferred language (as sent in the Accept-Language header).
if ($r->header_in("Accept-Language") !~ /\ben-US\b/i) { $r->print("No furriners!"); return OK; }
If you want to access more than one header, use the $r->headers_in method, which returns a list of key-value pairs of all clients' request headers, which are typically assigned to a hash:
%h = $r->headers_in; if ($h{"Accept-Language"} !~ /\ben-US\b/i) { $r->print("No furriners!"); return OK; }
Writing Apache Modules with Perl and C; Recipe 3.4 in mod_perl Developer's Cookbook; the Apache.pm manpage
Copyright © 2003 O'Reilly & Associates. All rights reserved.