On Wednesday, June 3, 2020 at 4:13:03 PM UTC-7, James O' Driscoll wrote: > > I am using webpack to create bundles for my app, controller/function > renders a view that’s has a script tag with a src to a bundle in static > folder. > > However I would like only logged in users to be able to access the bundle. > > I have tried to include the ja file, this works but it slows performance. > > Any ideas.
Normally, static files are just served. This is done based on your routes.py and its definition of a static path, and hand;ed in gluon/rewrite.py (where the default definition of a static path is defined). You can adjust routes.py so that paths for your bundle don't match, or you can put your bundle elsewhere. Then you need to consider how to serve the bundles, which might be through a controller (which can use @auth()) to imitate the static path. Check out the download() function, too. If you're using Rocket for your front-end, that's about all that's easy to do. If you have another front end, like nginx, then you can intercept the paths there and handle the authentication in the front end. (For SSL auth, the usual technique is, AIUI, to have the front end to the real authentication and then pass a token or a basic auth (via rewrite) to web2py. I still have to learn this trick, though, so my understanding is limited.) Good luck! /dps -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/5e8842b2-609e-440d-be2e-81e47f521616%40googlegroups.com.