MadSkills-io / fullstack-serverless

Serverless Plugin - Simplify creating a full stack serverless web app
https://www.madskills.io/fullstack-serverless
Other
111 stars 43 forks source link

Add objectHeaders option or option to disable caching for index.html #3

Closed superandrew213 closed 5 years ago

superandrew213 commented 5 years ago

Any plans to add objectHeaders option like in https://github.com/fernando-mc/serverless-finch?

It would fix issues like these: https://github.com/fernando-mc/serverless-finch/issues/40

I would like to disable CloudFront caching for index.html.

superandrew213 commented 5 years ago

You can already use objectHeaders. It's just not documented.

andrewphahn commented 5 years ago

@superandrew213 PRs for documentation updates would be gladly accepted! Or share what you did and I'll work it in...

superandrew213 commented 5 years ago

Just did the PR for documentation.

serverless-finch has added new functionality for their objectHeaders. They also accept a global pattern for the object. I removed this from the documentation for now since fullstack-serverless doesn't have this.

'someGlobPattern/*.html':
        - name: header-name
          value: header-value

They have also improved their S3 upload function. https://github.com/fernando-mc/serverless-finch/blob/master/lib/upload.js

I don't know if you want to fully mirror them (where appropriate), but the option for bucketPolicyFile would be really useful too. I don't need this at the moment, but when I do, I can add it.

superandrew213 commented 5 years ago

To fix https://github.com/fernando-mc/serverless-finch/issues/40, just add:

objectHeaders:
      index.html:
        - name: Cache-Control
          value: no-store, no-cache

It might be appropriate for singlePageApp to make this the default.