I am able to fix the mod_expires problem by doing a test to definitively identify is a request is a subrequest or not (testing r->main is not sufficient). It would be easy to add code to make_sub_request() to set a flag if the SUBREQ_CORE filter is added. This flag would definitively identify if a request is a subrequest or not. Then we could test (r->is_subreq) rather than (r->main) and be assured of correctly identifying a subrequest.
Pardon my late entry in this thread.
What about moving this mod_expires hook (add_expires) to insert_filter rather than having it in fixups? insert_filter is only invoked when the handler is run (see ap_invoke_handler). If the request had been processed by fast_redirect, the r->main would be NULL at this point (it'd inherit r->main of the original request). And, r->main would not be NULL for other types of subreqs.
By the time the handler is invoked, a fast redirect *is* equivalent to the normal request. But, fixups is run before this distinction can be made cleanly.
This, of course, makes perfect sense (to me) because add_expires *is* inserting a filter. Or, am I just missing something completely obvious here that would make this not work? -- justin
