Why is # rewritten to %23?

I’ve got a rewrite rule in my nginx config file to convert from an old
URL to a new one, but the new URL has a hash string in it, and it
doesn’t seem to be possible to get nginx to rewrite that without
encoding it.

The relevant rewrite rule is this:

            location /contact/dmes/term {
                    rewrite "/contact/dmes/term/(.*)" "/#term=$1";
            }

This then goes through the following proxy:

            location / {
                    proxy_pass_header Server;
                    proxy_set_header Host $http_host;
                    proxy_redirect off;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Scheme $scheme;
                    proxy_pass http://tornado;
            }

The URL that the proxied http server gets is this (as it appears in the
log):

WARNING:root:404 GET /%23term=14/ (127.0.0.1) 0.30ms

Is there some way to disable this behavior? Have I violated some
terrifying taboo? Thanks for any advice/flames!

%23 is the ASCII Hexidecimal equivalent to #.
See HTML Codes - Table of ascii characters and symbols for the full list of codes.
John

John Kennedy

On Dec 7, 2011, at 5:15 AM, John Kennedy wrote:

%23 is the ASCII Hexidecimal equivalent to #.

Yes, of course. What I meant was why is it encoding it and not leaving
it as I wrote it?