Possible rewrite regular expression bug?

Peter Hoang lists at ruby-forum.com
Wed Jun 25 09:01:37 MSD 2008


I'm looking at the log file and there is difference between how NGINX 
and Apache handle $args.

Apache:

(4) RewriteCond: input='GET /search/q-C%2B%2B.html HTTP/1.1' 
pattern='^[A-Z]{3,9}\ /search/([^\-]+)-([^/]*).html\ HTTP/' => matched
(2) rewrite '/search/q-C++.html' -> '/search?q=C%2B%2B'
(3) split uri=/search?q=C%2B%2B -> uri=/search, args=q=C%2B%2B
(2) forcing '/search' to get passed through to next API URI-to-filename 
handler

NGINX:

"^/search/([^\-]+)-([^/]*).html" matches "/search/q-C%2B%2B.html", 
client: 127.0.0.1, server: localhost, request: "GET 
/search/q-C%2B%2B.html HTTP/1.1", host: "localhost:82"
"^/search/([^\-]+)-(.*).html$" matches "/search/q-C++.html", client: 
127.0.0.1, server: localhost, request: "GET /search/q-C%2B%2B.html 
HTTP/1.1", host:
rewritten data: "/search", args: "q=C++", client: 127.0.0.1, server: 
localhost, request: "GET /search/q-C%2B%2B.html HTTP/1.1", host: 
"localhost:82"

As can be seen, Apache doesn't decode $args while NGINX does. Is it 
possible to orverwrite this behaviour? How much code needed to be 
changed? I wouldn't mind hacking the source if it's a simple change.

Thanks.
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list