Max-age header not being sent

I’m trying to enable images max-alive on the s3 bucket but it seems it’s not working with my config:

var s3Options = {
bucket: ‘app-images-bucket’,
region: ‘eu-west-1’,
bucketPrefix: ‘’,
directAccess: false,
baseUrl: ‘null’,
baseUrlDirect: true,
signatureVersion: ‘v4’,
globalCacheControl: “public, max-age=31536000”,
validateFilename: () => null,
generateKey: filename => filename,
}

When I retrieve the image and inspect headers I’m not getting max-age and image is retrieved every time again when I refresh the site. What am I doing wrong?
I’m using parse-server on Express.

Headers that I get back from the server are:

Access-Control-Allow-Headers: X-Parse-Master-Key, X-Parse-REST-API-Key, X-Parse-Javascript-Key, X-Parse-Application-Id, X-Parse-Client-Version, X-Parse-Session-Token, X-Requested-With, X-Parse-Revocable-Session, X-Parse-Request-Id, Content-Type, Pragma, Cache-Control, X-Locale, Content-Type, Origin, Accept, X-Requested-With, Access-Control-Request-Method, Access-Control-Request-Headers
Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: X-Parse-Job-Status-Id, X-Parse-Push-Status-Id
Connection: keep-alive
Content-Length: 26870
Content-Type: image/png
Date: Wed, 25 Aug 2021 14:20:13 GMT
Keep-Alive: timeout=5
X-Powered-By: Express

Since you have directAccess set to false, the file is being retrieved through Parse Server and not directly from S3. Could you please try with directAccess true?

that worked just fine, thank you

I’ve encountered a similar issue with the Max-age header not being sent. Have you tried checking your server configurations to ensure it’s set correctly? As a special gift of advice, you might want to review the cache-control settings and verify if there are any conflicting directives that could be affecting the Max-age header. Happy troubleshooting!