Веб-сервисы Amazon — добавление заголовка и истечения времени mCache-Control mdeflate в JS CSS и изображениях с использованием php-клиента AWS S3

Клиенту AWS S3 php не удалось добавить ресурсы Cache-Control и Compressing с помощью gzip или deflate в Object.

Info1: EC2 as hosting and select Ubuntu 14 as OS and install Apache PHP and i have check that it php and http works,

info2: Rds as mysql database instance. it is working

info3: I am using s3 clodefont for image css js front cdn

Выпуск:try to upload images css js and fonts file from below using php aws s3 client,

Я использую этот код, но не работает:

            $client = S3Client::factory(array(
'key'    => 'xxxxxxxx',
'secret' => 'xxxxx',
));

$bucket='mybucket';

$result = $client->putObject(array(
'Bucket'     => $bucket,
'Key'        => $destinationpath,
'Cache-Control' => 'max-age=86400',
'Expires' => date('D, d M Y H:i:s T', strtotime('+24 hours')),
'ACL'        => 'public-read',
'Content-Encoding' => 'gzip',
'SourceFile' => $sourcenpath,
));

Код выше not set compressing and Content-Encoding and Expires date

Мне нужна эта штука для ускорения

Хочу: Gzip compression or deflate, header Cache-Controla and Expires установить to new upload object of S3

Может кто-нибудь мне помочь?

1

Решение

Вам нужно использовать CacheControl & ContentEncoding (без тире).

Посмотреть AWS PHP SDK документация putObject Больше подробностей.

1

Другие решения

Других решений пока нет …