rewrite save original url

Maxim Dounin mdounin at mdounin.ru
Wed Sep 22 00:21:34 MSD 2010


Hello!

On Tue, Sep 21, 2010 at 03:21:31PM -0400, Arthur Blake wrote:

> When rewriting a url with the rewrite directive, is it possible to save the
> original url in a request header for the downstream handler?
> 
> Similar to the X-Rewrite-URL header built in to ISAPI rewrite.
> Or in Apache, I can do it with something like:
> 
> #== Capture original uri and query string into environment variable so it
> can be put in a header
> #== Match non-empty query string
> RewriteCond %{QUERY_STRING} (^.+$)
> RewriteRule (.*) $1 [E=x-rewrite-url:$1?%1]
> 
> If this is possible in nginx, how would I do it?

http://wiki.nginx.org/NginxHttpCoreModule#.24request_uri

Maxim Dounin



More information about the nginx mailing list