server level url rewrite & config rewrite or internal redirection cycle

et nginx-forum at nginx.us
Sat Dec 5 12:33:15 MSK 2009


Hi,

I am using "nginx version: nginx/0.7.64", the latest stable version.
I notice that rewrite on the server level won't respect the 'break' or 'last' flag. Is this a feature or a bug? According to the module doc, it should be a bug.


server {
    listen       80;
    server_name  hellogrow.corp.yahoo.com;
    root /home/test;

    error_log   logs/host.error.log notice;
    rewrite_log on;

	rewrite ^/favicon.ico(\?.*|)$ /frontend/template/default/img/favicon.ico break;
	rewrite ^/img/(.*\.(jpg|png|gif))$ /frontend/template/default/img/$1 break;
	rewrite ^/js/(.*\.js)$ /frontend/template/default/js/$1 break;
	rewrite ^/b_js/(.*\.js)$ /bframe/frontend/cache/js_cache/$1 break;
	rewrite ^/css/(.*\.css)$ /frontend/template/default/css/$1 break;
	rewrite ^/html/(.*)$ /frontend/html/$1 break;
}



rewrite_log:

2009/12/05 17:15:08  1352#0: *1 "^/favicon.ico(\?.*|)$" does not match "/img/fdsf.gif", client: 10.80.20.11, server: hellogrow.corp.yahoo.com, request: "GET /img/fdsf.gif?fdskaf=dkfksk HTTP/1.1", host: "hellogrow.corp.yahoo.com"
2009/12/05 17:15:08  1352#0: *1 "^/img/(.*\.(jpg|png|gif))$" matches "/img/fdsf.gif", client: 10.80.20.11, server: hellogrow.corp.yahoo.com, request: "GET /img/fdsf.gif?fdskaf=dkfksk HTTP/1.1", host: "hellogrow.corp.yahoo.com"
2009/12/05 17:15:08  1352#0: *1 rewritten data: "/frontend/template/default/img/fdsf.gif", args: "fdskaf=dkfksk", client: 10.80.20.11, server: hellogrow.corp.yahoo.com, request: "GET /img/fdsf.gif?fdskaf=dkfksk HTTP/1.1", host: "hellogrow.corp.yahoo.com"
2009/12/05 17:15:08  1352#0: *1 "^/favicon.ico(\?.*|)$" does not match "/frontend/template/default/img/fdsf.gif", client: 10.80.20.11, server: hellogrow.corp.yahoo.com, request: "GET /img/fdsf.gif?fdskaf=dkfksk HTTP/1.1", host: "hellogrow.corp.yahoo.com"
...




Another question is that if there's a hidden config directive that controls the cycle numbers of internal redirection or rewrite since this cycle can be used to mimic the 'next|N' flag in Apache rewrite module.

Thanks,
-ET

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,28189,28189#msg-28189




More information about the nginx mailing list