You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/06/19 10:38:32 UTC

[Bug 58052] RewriteValve: Implement additional RewriteRule directive capabilities

https://bz.apache.org/bugzilla/show_bug.cgi?id=58052

Remy Maucherat <re...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|RewriteValve: Rewrite to a  |RewriteValve: Implement
                   |complete URI does not work  |additional RewriteRule
                   |because the colon is URL    |directive capabilities
                   |encoded                     |
           Priority|P2                          |P4
             Status|RESOLVED                    |REOPENED
           Severity|normal                      |enhancement
         Resolution|FIXED                       |---

--- Comment #4 from Remy Maucherat <re...@apache.org> ---
The behavior corresponds to what is documented in the Tomcat documentation.
However, it seems reading the mod_rewrite documentation that additional
capabilities were added or officially documented to the RewriteRule directive.

Tomcat's RewriteValve only supports the "-" and URL-path options for the
substitution, while now mod_rewrite has external rewrite auto detect (useful,
but all you need to do is manually add the "R" flag, so it's a very minor
enhancement) and a file serving feature (that could be questionable for Servlet
security). So this becomes a low priority enhancement that will either be
implemented or the documentation be further clarified that unlike mod_rewrite
it doesn't support file serving and/or auto external redirect.

>From the current mod_rewrite documentation:

The Substitution of a rewrite rule is the string that replaces the original
URL-path that was matched by Pattern. The Substitution may be a:

file-system path
    Designates the location on the file-system of the resource to be delivered
to the client. Substitutions are only treated as a file-system path when the
rule is configured in server (virtualhost) context and the first component of
the path in the substitution exists in the file-system

URL-path
    A DocumentRoot-relative path to the resource to be served. Note that
mod_rewrite tries to guess whether you have specified a file-system path or a
URL-path by checking to see if the first segment of the path exists at the root
of the file-system. For example, if you specify a Substitution string of
/www/file.html, then this will be treated as a URL-path unless a directory
named www exists at the root or your file-system (or, in the case of using
rewrites in a .htaccess file, relative to your document root), in which case it
will be treated as a file-system path. If you wish other URL-mapping directives
(such as Alias) to be applied to the resulting URL-path, use the [PT] flag as
described below.

Absolute URL
    If an absolute URL is specified, mod_rewrite checks to see whether the
hostname matches the current host. If it does, the scheme and hostname are
stripped out and the resulting path is treated as a URL-path. Otherwise, an
external redirect is performed for the given URL. To force an external redirect
back to the current host, see the [R] flag below.

- (dash)
    A dash indicates that no substitution should be performed (the existing
path is passed through untouched). This is used when a flag (see below) needs
to be applied without changing the path.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org