Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multidomain Cache #99

Open
MazzMazz opened this issue Feb 18, 2022 · 3 comments · May be fixed by #103
Open

multidomain Cache #99

MazzMazz opened this issue Feb 18, 2022 · 3 comments · May be fixed by #103

Comments

@MazzMazz
Copy link

Is it Somehow possible to make a subdirectory for the cache? We serve multiple domains via one laravel Project.

e.g. testsite1.de, testsite1.at, testsite1.com

unfortunately the index file is always overwritten and/or serves the wrong website.

@lukasreusch
Copy link

We are facing the same challenge.

@JohnDotOwl
Copy link

Any updates on this?

@michaellindahl
Copy link

michaellindahl commented Aug 8, 2022

If you are not caching the routes in production, you can have each domain have it's own page cache using the following command:

use Silber\PageCache\Cache as PageCache;
app()->make(PageCache::class)->setCachePath($folder);

This works well if you have a separate routes/domain.php file per domain rather than using the default routes/web.php. Just at that command to the top of each routes file.

Update: While this seems like it should work, I'm seeing the cache path only being able to be overridden for one location. I also looked into building multiple middleware, using an anonymous function to create an instance of CacheResponse with it's own Cache object, but this also was tricky. I think the best option here is to add the ability to provide a path as a middleware parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants