https://issues.apache.org/bugzilla/show_bug.cgi?id=52774

Jerome Grandjanny <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from Jerome Grandjanny <[email protected]> 
2012-02-29 20:26:07 UTC ---
Yes, here is a verbatim minimal configuration file allowing to show the issue :

    ServerRoot "/etc/apache2"
    User  www-data
    Group www-data

    LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
    LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
    LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

    ErrorLog /var/log/apache2/error.log
    LogLevel debug
    CustomLog /var/log/apache2/access.log "%h %l %u %t \"%r\" %>s %b"
    RewriteLog /var/log/apache2/rewrite.log
    RewriteLogLevel 9

    Listen 127.0.0.1:81
    ServerName localhost
    ProxyRequests On
    RewriteEngine On
    RewriteRule /ads/ - [forbidden]

This is intended to be an outgoing proxy which blocks any request having the
string /ads/ in the URL.

1) Expected behavior :
   -------------------
     Request 1 : GET
http://pubs.lemonde.fr/RealMedia/ads/click_lx.ads/INTERNATIONAL-LEMONDE/articles_international/exclu/tall/L50/L50/306065288/x21/OasDefault/lm_ysl_06010_rg02_sp/ibm_emagazine_rg01_sp.html/576879454745394f676c554142765042
HTTP/1.0
     Response 1 : HTTP/1.1 403 Forbidden

     Request 2 : GET http://www.hpmuseum.org HTTP/1.O
     Response 2 : HTTP/1.1 200 Ok

     Explanation : when the request contains the string /ads/, the RewriteRule
immediately rejects it. For any other request, the RewriteRule is not triggered
and the request is proxyied by mod_proxy.

2) Actual behavior :
   -----------------
     Request 1 : Same as below
     Response 1 : HTTP/1.1 302 Found
     Content of access.log : 127.0.0.1 - - [29/Feb/2012:20:56:36 +0100] "GET
http://pubs.lemonde.fr/RealMedia/ads/click_lx.ads/INTERNATIONAL-LEMONDE/articles_international/exclu/tall/L50/L50/306065288/x21/OasDefault/lm_ysl_06010_rg02_sp/ibm_emagazine_rg01_sp.html/576879454745394f676c554142765042
HTTP/1.0" 302 399
     Content of rewrite.log : empty

3) Verification with the line "ProxyRequests On" commented out :
   -------------------------------------------------------------
     Request 1 : Same as below
     Response 1 : HTTP/1.1 403 Forbidden
     Content of access.log : 127.0.0.1 - - [29/Feb/2012:20:57:56 +0100] "GET
http://pubs.lemonde.fr/RealMedia/ads/click_lx.ads/INTERNATIONAL-LEMONDE/articles_international/exclu/tall/L50/L50/306065288/x21/OasDefault/lm_ysl_06010_rg02_sp/ibm_emagazine_rg01_sp.html/576879454745394f676c554142765042
HTTP/1.0" 403 398
     Content of rewrite.log :
        127.0.0.1 - - [29/Feb/2012:20:57:56 +0100]
[pubs.lemonde.fr/sid#203f78e8][rid#2047d960/initial] (2) init rewrite engine
with requested uri
/RealMedia/ads/click_lx.ads/INTERNATIONAL-LEMONDE/articles_international/exclu/tall/L50/L50/306065288/x21/OasDefault/lm_ysl_06010_rg02_sp/ibm_emagazine_rg01_sp.html/576879454745394f676c554142765042
        127.0.0.1 - - [29/Feb/2012:20:57:56 +0100]
[pubs.lemonde.fr/sid#203f78e8][rid#2047d960/initial] (3) applying pattern
'/ads/' to uri
'/RealMedia/ads/click_lx.ads/INTERNATIONAL-LEMONDE/articles_international/exclu/tall/L50/L50/306065288/x21/OasDefault/lm_ysl_06010_rg02_sp/ibm_emagazine_rg01_sp.html/576879454745394f676c554142765042'
        127.0.0.1 - - [29/Feb/2012:20:57:56 +0100]
[pubs.lemonde.fr/sid#203f78e8][rid#2047d960/initial] (2) forcing responsecode
403 for
/RealMedia/ads/click_lx.ads/INTERNATIONAL-LEMONDE/articles_international/exclu/tall/L50/L50/306065288/x21/OasDefault/lm_ysl_06010_rg02_sp/ibm_emagazine_rg01_sp.html/576879454745394f676c554142765042

This show that, in the first configuration, rewrite_mod doesn't have a chance
to process the request before mod_proxy. In the "verification" configuration,
we see that the RewriteRule works perfectly when mod_proxy is not sollicited.

In the real life, I use this kind of configuration with a bunch of RewriteRules
and RewriteConds to eliminate advertisments from my navigations. It was working
nice for years and years on many systems until my Ubuntu updated Apache Httpd
to 2.2.14 and then it was broken.

Thanks for your time,
Best regards,
Jerome.

-- 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to