21.10.3. Discussion
The client thinks your pages have a URL like
http://www.example.com/ID/12345678/path/to/page.html.
Your PerlTransHandler intercepts the incoming request and removes the
/ID/12345678 part before Apache tries to
translate the request into a file location. Just before your content
handler runs, your PerlFixupHandler reinserts the ID. When your
content handler calls $r->uri, it gets a URI
that includes the ID.
We returned DECLINED from our PerlTransHandler and PerlFixupHandler
to indicate that any other translation or fixup handlers that were
installed should also be run. If we returned OK in the
PerlTransHandler, Apache would not call any subsequent translation
handlers. In PerlFixupHandlers, DECLINED and OK both mean a
successful fixup, and that other fixup handlers should also run.
This solution doesn't look at the HTML emitted by your handler, so it
only preserves the ID across relative links. If you give absolute
links in your HTML (HREF="/elsewhere/"), then
you'll lose the ID and have to re-establish it.