- Request processing is handled in a series of phases:
Once Apache has received the request and read the header,
all modules registered for this phase are invoked in order.
Things like the client's User-Agent field
are examined, since they're not dependent upon transformations
the server might apply to the request.
- translate_handler (URI translation)
This is the point at which
manipulations of the URL are done.
For example, it might be rewritten
by mod_rewrite to redirect the request.
This is also the phase during which any mapping of the URI
to a filesystem location takes place;
Alias, ScriptAlias and similar
directives are applied at this point.
This phase was originally designed to be used
for analysing the request header, but became
obsolete as the server evolved and the
post_read_request phase was added.
Strong authentication checks are applied, if appropriate.
- ap_check_user_id (authentication)
This phase checks for weak authentication.
- auth_checker (authorization)
If weak authentication was applied
and the client credentials passed the check,
this phase performs the authorisation aspect
of the checking -- seeing if the user actually
has access to the requested document.
Now the Require directive is checked.
- type_checker (MIME type checking)
This phase is used to determine the
content-type of the response,
if it can be determined.
Sometimes it cannot be determined when
the document is dynamically generated.
This phase provides an opportunity for modules
to perform any last-millisecond cleanup,
correction, or fixup operations.
- content generation
At last, the response header
and response body are actually sent back to the client.
- By the time this phase begins,
the request is essentially complete;
the client has received its response,
and the server just needs to do some bookkeeping.
Logging demands I/O, which may be delayed or blocked
on a busy server.
By deferring this phase until after all the others,
service to the client isn't delayed or blocked.
- Each module can register to participate in one or more phases.
- As the server moves through the handling of the request,
all modules registered for each phase in turn are invoked in order.
- The order of the LoadModule directives is significant.
Apache manages its modules with a stack.
pushes a module onto the top of the stack.
Modules that should be executed first,
such as those upon which others depend, should be loaded last.
- The module order can be changed by
the ClearModuleList and AddModule directives.
Following a ClearModuleList directive,
only modules that are subsequently added by
AddModule directives will be available.