> Hello, > > we are using uWSGI for some time on pripravto.cz project for > joiners/furniture makers. It works quite nice, we mostly like options and > stats, and error logging. Currently we wanted to improve serving of static > files (we are currently serving them through app) have tried to use serve > static files. We have tried option static-map= which works quite nice, but > we need to control access to files a little so we have tried route option. > When file is present it works quite nice. But when file is not present, it > gets called several times (we are not sure why). It seems that it is not > possible to server error 404? It just recursively calls several times and > under HTTPS it actually does not server response to client. Just this one > line makes it to behave this way. If we remove it > serving is done by our > app and it is okay. > > route = ^/static/(.*) static:$(PWD)/static/$1 > > > We were using with uwsgi 2.0.14, python2.7.12, build with pcre, we have > single interpreter option, threads, processes, master process a > offloading. > All this is under ubuntu12.04 Is there a way how this can be stopped, or > are we doing something wrong? Bellow there is log for accessing file which > is in directory and then again which is not there. We have actually wanted > to use route-labels and other routing stuff, but it turns out, that it > behaves in same way. > > Anyway, thanks for great project, which is fairly easy to use and just > works. > > > > ####FIRST requests served via 304 and offload when file is present > {address space usage: 468115456 bytes/446MB} {rss usage: 24731648 > bytes/23MB} [pid: 17381|app: -1|req: -1/6] 127.0.0.1 () {44 vars in 878 > bytes} [Sat Mar 25 13:55:57 2017] GET /static/js/utils.js => generated > 71231 bytes in 0 msecs via offload() (HTTP/1.1 200) 2 headers in 88 bytes > (0 switches on core 0) > {address space usage: 468115456 bytes/446MB} {rss usage: 24612864 > bytes/23MB} [pid: 17378|app: -1|req: -1/7] 127.0.0.1 () {44 vars in 911 > bytes} [Sat Mar 25 13:56:07 2017] GET /static/js/utils.js => generated 0 > bytes in 0 msecs (HTTP/1.1 304) 0 headers in 29 bytes (0 switches on core > 3) > > > ####File is not in directory > here it just gets called several times > {address space usage: 468115456 bytes/446MB} {rss usage: 24776704 > bytes/23MB} [pid: 17381|app: -1|req: -1/8] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 1) > {address space usage: 468115456 bytes/446MB} {rss usage: 24641536 > bytes/23MB} [pid: 17378|app: -1|req: -1/9] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 2) > {address space usage: 468115456 bytes/446MB} {rss usage: 24526848 > bytes/23MB} [pid: 17382|app: -1|req: -1/10] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0) > {address space usage: 468115456 bytes/446MB} {rss usage: 24563712 > bytes/23MB} [pid: 17382|app: -1|req: -1/11] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0) > {address space usage: 468115456 bytes/446MB} {rss usage: 24666112 > bytes/23MB} [pid: 17378|app: -1|req: -1/12] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 1) > {address space usage: 468115456 bytes/446MB} {rss usage: 24690688 > bytes/23MB} [pid: 17378|app: -1|req: -1/13] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 1) > {address space usage: 468115456 bytes/446MB} {rss usage: 24694784 > bytes/23MB} [pid: 17378|app: -1|req: -1/14] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 3) > {address space usage: 468115456 bytes/446MB} {rss usage: 24694784 > bytes/23MB} [pid: 17378|app: -1|req: -1/15] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0) > {address space usage: 468115456 bytes/446MB} {rss usage: 24739840 > bytes/23MB} [pid: 17378|app: -1|req: -1/16] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 2) > {address space usage: 468115456 bytes/446MB} {rss usage: 24743936 > bytes/23MB} [pid: 17378|app: -1|req: -1/17] 127.0.0.1 () {40 vars in 813 > bytes} [Sat Mar 25 13:56:54 2017] GET /static/js/us => generated 0 bytes > in > 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 1) > > -- > Regards, > > Zdenek & Michal > >
Hi, the retrying og the static files is pretty strange, it looks like the client is triggering the retry when it gets 500. By the way, there is a plugin called notfound in the project that you can use as a fallback, but i think in your specific case the break:404 Not Found routing action would be more suited: route = ^/static/(.*) static:$(PWD)/static/$1 ; if the previous rule fails, returns 404 route-run = break:404 Not Found -- Roberto De Ioris http://unbit.com _______________________________________________ uWSGI mailing list uWSGI@lists.unbit.it http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi