Public routes blow up Laravel (in a weird way!)

Public routes can grind your Laravel app to a halt. See why and how to fix it! A public “asset“ route is one created dynamically in your Laravel code base, but serves “static asset” such as an SVG or JS embed meant to be used by your users/customers. However this means any traffic your customers get, you get (since they’re serving up YOUR asset on their site)! There’s two ways this breaks Laravel: 1. Creating too many sessions 2. Overloading your server We see what the session issue is, and 2 ways to fix it. Then we discuss what to do about overloaded servers. The real danger is that when you create embeds or other assets that your users add to their site, their web traffic becomes your web traffic. This create a session per your customer’s users, which results in your disk filling up (storage issues) or creating too many files (inode issues). Of course, it can also overload your poor server with traffic it’s not meant to handle. Here’s how to handle these scenarios. ⌚️ Timestamps 00:00 What’s a public route 00:18 How public routes break things 00:52 Session are dangerous 02:22 Sessions quick fix 04:44 Better session fix (custom routes) 06:21 Handling overloaded servers
Back to Top