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 2006/10/12 06:11:11 UTC
DO NOT REPLY [Bug 40737] New: - mod_rewrite rewritecond does not support %{} variables in the CondPattern
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40737>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40737
Summary: mod_rewrite rewritecond does not support %{} variables
in the CondPattern
Product: Apache httpd-2
Version: 2.0.54
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: mod_rewrite
AssignedTo: bugs@httpd.apache.org
ReportedBy: mbuchmann@shaw.ca
I'm attempting to do a basic rewrite to force all hits to a consistent URI,
i.e.: IP-only hits, miXedCase hostnames, http://etc.. hits are all redirected
to a consistent https://www.example.com/
My server configuration/rewrite rules are as follows:
ServerName www.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} !^%{SERVER_NAME}$ [OR]
RewriteCond %{SERVER_PORT] !^443$
RewriteRule (.*) https://%{SERVER_NAME}$1 [L,R=301]
Attempting a hit on https://wWw.exAMPLe.COm produces the following log entry
(4) RewriteCond: input='wWw.exAMPLe.COm' pattern='!^%{SERVER_NAME}$' => matched
(2) rewrite / -> https://www.example.com/
(2) explicitly forcing redirect with https://www.example.com/
and then we enter into an infinite redirection loop, as the HTTP_HOST will never
match the literal string '%{SERVER_NAME}'. Rewriting the Cond rule as
RewriteCond %{HTTP_HOST} !^www.example.com$ [OR]
solves the redirect, as the rule match will fail when the HTTP_HOST properly
matches the SERVER_NAME.
Enabling expansion of %{} variables in the CondPattern would allow writing
generic rules (as I attempted above) which could be slurped in at various places
in the .conf files using Include, without having to customize them for each and
every vhost requiring such redirection.
This was all done on a RedHat Enterprise 4 ES (Nahant Update 4) server, with
FireFox 1.5.0.7 as the client and Apache 2.0.52-28 (most recent up2date
version). Problem should be consistent across all version of Apache and mod_rewrite.
Thanks for your time.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 40737] - mod_rewrite rewritecond does not support %{} variables in the CondPattern
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40737>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40737
------- Additional Comments From mbuchmann@shaw.ca 2006-10-12 08:14 -------
That works perfectly. Thanks!
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 40737] - mod_rewrite rewritecond does not support %{} variables in the CondPattern
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40737>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40737
sander@temme.net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 40737] - mod_rewrite rewritecond does not support %{} variables in the CondPattern
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40737>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40737
------- Additional Comments From rpluem@apache.org 2006-10-12 03:04 -------
Try
RewriteCond %{HTTP_HOST}%{SERVER_NAME} !^(.*)\1$
instead.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 40737] - mod_rewrite rewritecond does not support %{} variables in the CondPattern
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40737>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40737
rpluem@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
------- Additional Comments From rpluem@apache.org 2006-10-12 02:45 -------
This would create a big performance penalty as it would require to recompile the
regular expression each time a rule is used. Today they are compiled during
server startup.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org