Multi tenant separation of assets

Posted 3 years ago by vercoutere

This isn't really Laravel specific, however I'm currently building my app on Laravel so maybe there's something, somewhere in the framework that can help me out.

There's a lot of discussion on the internet about database architecture when designing multi tenant applications.

What I can't find any information about is what would be the best practices to separate assets.

Let me give an example:

Using the default Laravel folder structure we'd place all images in a subdirectory of the public directory.

Let's assume we have two websites called website1 and website2 and this is the directory structure we have in our public folder:

public

--- website1
------ img
------ css
------ js

---website2
------ img
------ css
------ js

This would all work fine, but you could request and image for website1 by visiting something like website2.com/website1/img/image.jpg.

Obviously this isn't something we want in a multi tenant environment.

So my question is:

How do you go about separating assets in a multi tenant environment.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.