in kibana/lambda_function.py [0:0]
def redirect_to_object(data: bytes, event: dict, content_type: str):
data = BytesIO(data)
bucket_path = f'bucket_cached{event["path"]}'
s3.upload_fileobj(
data, KIBANA_BUCKET, bucket_path, ExtraArgs={"ContentType": content_type}
)
response = {
"statusCode": "301",
"body": None,
"headers": {
"Location": f'{CLOUDFRONT_CACHE_URL}{event["path"]}',
"Cache-Control": f"max-age={S3_MAX_AGE}",
},
}
logger.info(response)
return response