While working with caching, I noticed what seems to me like a caveat in web2py's current design.
When serving static files from the webserver, you can either : - use the "static" pseudo-controller (it's actually a route built directly above the WSGI), in which case you can't set your own caching strategy. Worse, "static" by default sets this value "headers.setdefault( 'Cache-Control', 'private')", which in turn becomes a major hindrance when building a CDN proxy on top of the webserver. Let me explain myself here : your may want to simply add a CDN layer above your webserver so that it handles the caching strategy (Cloudfront does that just fine with behaviour settings). Problem is : Cloudfront will refuse to cache any data if the origin specifies "private" as Cache-Control (because "private" basically means it shouldn't be cached on a server-scale), so not only does web2py not allow for a custom caching strategy, but it also prevents your from using an alternative means - build your own controller for serving your static files with whichever headers you see fit. The issue there would be that your controller would be run after models, which is a waste of resources, practically resulting in a high TTFB (Time to First Byte). This can be balanced back with a CDN layer though. - add a MiddleWare that handles static files more efficiently that web2py does (haven't had any luck so far, so I can't say wether it's doable or not) I'll post about building a custom static controller soon, but I'm curious if anyone has a better solution :) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.