* Roberto De Ioris <[email protected]> [2013-03-16 17:09]: > >> * Roberto De Ioris >> <[email protected]> [2013-03-16 >> 16:46]: >>> >>>> Hi, >>>> >>>> I've a problem getting rewriting via router_rewrite to work, the >>>> following rewrite rule does not seem to do anything: >>>> >>>> $ ./uwsgi >>>> --plugins=0:notfound,http,router_redirect,router_rewrite,router_static >>>> --http-socket=:8080 --check-static=$PWD --route-uri='^/logo$ >>>> rewrite-last: >>>> /logo_uWSGI.png' >>>> $ curl -I http://127.0.0.1:8080/logo >>>> HTTP/1.1 404 Not Found >>>> Connection: close >>>> Content-Type: text/plain >>>> >>>> $ curl -I http://127.0.0.1:8080/logo_uWSGI.png >>>> HTTP/1.1 200 OK >>>> Content-Type: image/png >>>> Content-Length: 5971 >>>> Last-Modified: Sun, 10 Mar 2013 21:24:48 GMT >>>> >>>> Am I doing something wrong or is this a bug? This isn't related >>>> to bug #183, it happens before the fix as well. >>>> -- >>>> Guido Berhoerster >>>> _______________________________________________ >>>> >>> >>> Check-static happens before routing. What you "rewrite" are the CGI vars >>> (PATH_INFO and QUERY_STRING) passed to the plugin. >> >> Ok, that makes sense, my expectations are still heavily >> influenced by mod_rewrite and nginx's httprewrite module. >> >>> Hint: are you sure you do not need a "static" plugin like the 404 one ? >> >> I suppose, together with autoindex functionality it could >> probably completely replace the need for a webserver like nginx, >> lighttpd, or apache. But currently no such thing exists, right? > > I think you will be able to write it (based on the notfound and > router_static) in no more than 20 lines :) > > After having parsed the request (uwsgi_parse_vars(), line in "notfound") > you only need to call: > > uwsgi_file_serve(wsgi_req, docroot, docroot_len, path_info, path_info_len, > is_a_file); > > (is_a_file force the function to consider path_info as a full filename as > we do in router_static, ignoring the document root) > > You do not need to bother about performance or security, your plugin can > focus on generation fo document_roots and filenames
Thanks for the hints, I will definitely have a look at that once I've got a bit more time. -- Guido Berhoerster _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
