httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 52342] New: ap_internal_redirect dropping filters means inconsistent behaviour for includes
Date Thu, 15 Dec 2011 16:15:47 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=52342

             Bug #: 52342
           Summary: ap_internal_redirect dropping filters means
                    inconsistent behaviour for includes
           Product: Apache httpd-2
           Version: 2.2.21
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: matthew.byng-maddick@bbc.co.uk
    Classification: Unclassified


Created attachment 28076
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28076
mod_rewrite and mod_http patch to allow internal_redirect to retain filters and
notes

In our setup, we have people using .htaccess files (still). We also have lots
of proxying between various different service groups of the website.

In order to make the proxying consistent, we have a global main config
ProxyPass rule, which points to the correct service group for that environment
(eg. live, stage, test etc).

So, in main config:
ProxyPass /_proxy_/pal/ http://pal.<environment>.<site>/

And then in .htaccess:
RewriteRule mything /_proxy_/pal/myotherthing

Which, because it's in .htaccess gets internal-redirected and properly handled
by the mod_proxy stage. All good.

We *also* use mod_include extensively on this platform, and we have an
extension "sssi" to which we make sure we add an INCLUDES Output filter.

What we end up with, however, is that if you have, in .htaccess:
RewriteRule ^mything\.sssi$ http://pal.<environment>.<site>/mysite/mything.sssi
[P]
then the include gets parsed, as expected. If, on the other hand, you have:
RewriteRule ^mything\.sssi$ /_proxy_/pal/mysite/mything.sssi
then the includes filter gets stripped (described below) and the inclusion just
gets injected into the page instead of being parsed as sssi.

This is basically due to the default behaviour of internal_internal_redirect()
in modules/http/http_request.c, which strips output filters (except for the
sub_req filter in the case that that's being used) and replaces a completely
new r->notes table.

This is sensible behaviour when an internal redirect is being used to, say,
generate an error page, or similar, but is less useful when you then get
different behaviour in mod_rewrite depending on whether you put the RewriteRule
in main config or .htaccess and where in main config it goes.

The attached patch adds a new ap_internal_redirect_filter() function in the
httpd public API, which keeps the input and output filter chain and notes
(while still replacing the environment) by changing the calling convention
slightly for internal_internal_redirect() which isn't part of the public API,
and adds a new RewriteOptions option to mod_rewrite which allows it to do the
ap_internal_redirect_filter() when it redirects, rather than always doing the
ap_internal_redirect() which will strip the filter.

(the reason for the 1<<3 as the value rather than 1<<2 is that we're also
currently applying 1<<2 as part of the bug in 48304 - which is now merged with
httpd-2.4.x)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message