You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2008/07/24 21:08:38 UTC

DO NOT REPLY [Bug 45478] New: R flag in RewriteRule does not honor 400 and 500 range error code

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

           Summary: R flag in RewriteRule does not honor 400 and 500 range
                    error code
           Product: Apache httpd-2
           Version: 2.0.59
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_rewrite
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: anny.mak@springsource.com


R flag in RewriteRule does not accept 400s and 500s error code.

To reproduce:

RewriteEngine On
RewriteCond %{THE_REQUEST} "HTTP/1.[01]$"
RewriteRule .* - [R=400]


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478





--- Comment #7 from Anny Mak <an...@springsource.com>  2008-07-27 13:28:49 PST ---
I did that on purpose, just to provide a condition to satisfy the condition in
order to trigger the RewriteRule, as I do not know how to provide an invalid
protocol header.

In real life situation, yes, the negation, !, would have been added.


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478





--- Comment #5 from Will Rowe <wr...@apache.org>  2008-07-24 15:48:44 PST ---
Yes, though it's irrelevant as there is no other way to specify a custom
response code and therefore this feature should not have been broken.

I'm 99% certain it did work in 2.0, and perhaps as far back as 1.3.  I've
used it in custom rules to cripple Host:'less requests (anonymous crawlers).

In the <300, >=400 cases, one can think of this as [R{esponse}=nnn} as
opposed to [R{edirect}], and it really harms nothing to overload it.


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478





--- Comment #4 from Eric Covener <co...@gmail.com>  2008-07-24 14:25:54 PST ---
 (In reply to comment #3)

> No; 2.0 behaved correctly, at one point, and the documentation closes with
> 
> "While this is typically used for redirects, any valid status code can be given
> here. If the status code is outside the redirect range (300-399), then the
> Substitution string is dropped and rewriting is stopped as if the L flag was
> used."


This "...typically..." clause is only in 2.2 doc though, right?


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478





--- Comment #10 from Anny Mak <an...@springsource.com>  2008-07-27 21:38:22 PST ---
Put the rewrite condition inside <Location /> still gets the same error:

RewriteEngine On
RewriteLog logs/rewrite.log
RewriteLogLevel debug
<Location />
RewriteCond %{THE_REQUEST} "HTTP/1.[01]$"
RewriteRule .* - [R=400]
</Location>

Since it fails during the start up phrase, the error.log file has not even been
generated yet.  The error is printed to stdout:

Starting Apache
Syntax error on line 362 of
/local0/anny/ers31/servers/20reqproctest/conf/httpsd.conf:
RewriteRule: invalid HTTP response code for flag 'R'
Server start FAILED

The "httpd -v" output is:

Server version: Apache/2.0.59
Server built:   Aug 31 2006 19:47:37


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478


Will Rowe <wr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




--- Comment #6 from Will Rowe <wr...@apache.org>  2008-07-27 13:18:52 PST ---
Just validated your example config;

RewriteEngine On
RewriteCond %{THE_REQUEST} "HTTP/1.[01]$"
RewriteRule .* - [R=400]

The only exception/disallowed values are those HTTPD does not issue, itself.
So for example, 499 would be invalid, but 400 or 500 for example are fine.

If you were simply testing for invalid HTTP values, are you sure you didn't
omit the ! negation symbol?  e.g. the snippet below works for me;

RewriteEngine On
RewriteCond %{THE_REQUEST} "! HTTP/1.[01]$"
RewriteRule .* - [R=400]

and no errors are reported in the error log, it accepts the R=400 value.


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478





--- Comment #8 from Will Rowe <wr...@apache.org>  2008-07-27 14:46:45 PST ---
Can you provide the exact error.log result and httpd -v information for this?
It seems to be correct on the current 2.0 and 2.2 flavors, and I didn't dig
much deeper than that.


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478


Will Rowe <wr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




--- Comment #3 from Will Rowe <wr...@apache.org>  2008-07-24 12:57:22 PST ---
No; 2.0 behaved correctly, at one point, and the documentation closes with

"While this is typically used for redirects, any valid status code can be given
here. If the status code is outside the redirect range (300-399), then the
Substitution string is dropped and rewriting is stopped as if the L flag was
used."

outside of 300-399, R=VAL must work as documented.


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478


Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




--- Comment #1 from Eric Covener <co...@gmail.com>  2008-07-24 12:39:01 PST ---
AFAICT, Only 2.2 doc says you can supply a non-3xx status code. 2.2.x does what
the manual says, returns the status and stops rewriting (and no redirect of
course.


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478





--- Comment #9 from Will Rowe <wr...@apache.org>  2008-07-27 14:48:05 PST ---
(Due to the nature of rewriting url's, please be sure to put the example you
mentioned in a <Location /> block... I don't really have a clue what it would
mean to try to put this in a global or virtual host section)


-- 
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


DO NOT REPLY [Bug 45478] R flag in RewriteRule does not honor 400 and 500 range error code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45478





--- Comment #2 from Anny Mak <an...@springsource.com>  2008-07-24 12:48:30 PST ---
Perhaps the doc can be more explicit than saying:

'redirect|R [=code]' (force redirect)
...If you want to use other response codes in the range 300-400, simply specify
the appropriate number or use one of the following symbolic names: temp
(default), permanent, seeother...

Something like:

'redirect|R [=code]' (force redirect)
...If you want to use other response codes in the 300 range, simply specify the
appropriate number or use one of the following symbolic names: temp (default),
permanent, seeother. Please note that error codes other than those in the 300
range are not supported...


-- 
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