Hi,

Perhaps, my question is a little bit stupid, but I could not find an easy way to send 404 response when serving static files.

Using static-map hands over request to application if file does not exist, while using route add a bit of overhead due to URI matching.

What I basically want is something like:

static-map-only = /s=/static/files

which will *only* serve static files from defined path and return 404 when file is not there and 403 on permission denied.

So far, I use this super-inelegant solution:

static-dir = /home/www/static
route = ^/s/ goto:static

route-label = static
route = ^/s/(.*) addvar:FILE=$1
route-if = isfile:%(static-dir)/${FILE} static:%(static-dir)/${FILE}
route = . return:404

but I refuse to believe that there is no other (easy) way :)

Any suggestions?

--
Best regards,
Alexander.

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to