Laravel Http Image Caching Control Header for React Native App

354 Views Asked by At

I need caching laravel storage image for my React Native app. How can I send my image with cache control header?

1

There are 1 best solutions below

0
Berat On

resolved. if you want you can global set cache header in RouteServiceProvider.

here:

public function boot()
    {
        $this->configureRateLimiting();

        $this->routes(function () {
            Route::prefix('api')
                ->middleware('api')
                ->middleware('cache.headers:private;max_age=7200')
                ->namespace($this->namespace)
                ->group(base_path('routes/api.php'));

            Route::middleware('web')
                ->namespace($this->namespace)
                ->middleware('cache.headers:private;max_age=7200')
                ->group(base_path('routes/web.php'));
        });
    }