Skip to content
CLI app for setting HTTP headers on S3 objects
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
.editorconfig
.gitignore
.markdownlint.yml
.travis.yml
LICENSE
README.md
config-sample.yml
go.mod
go.sum
main.go

README.md

s3headersetter

Build Status Go Report Card MIT

Introduction

s3headersetter is a CLI application for setting the Cache-Control and Content-Type HTTP headers on S3 objects.

Rules

The headers and values to apply must be specified in a YAML file.

For example, the following YAML will:

  • Set Cache-Control to max-age=3600, public on .html objects.
  • Set Cache-Control to max-age=604800, public on .css objects.
  • Set Cache-Control to max-age=31536000, public on all other objects.
  • Set Content-Type to font/woff2 on .woff2 objects.
rules:
  - header:        Cache-Control
    when:
      - extension: .html
        then:      max-age=3600, public
      - extension: .css
        then:      max-age=604800, public
    else:          max-age=31536000, public

  - header:        Content-Type
    when:
      - extension: .woff2
        then:      font/woff2

Downloading & installing

Release builds for Linux, macOS and Windows can be downloaded from the releases page.

There is no installation process; just put the executable wherever you want.

Usage

s3headersetter -config <CONFIG FILENAME> -bucket <BUCKET> (-key-prefix <PREFIX>)

For example:

s3headersetter -config config-sample.yml -bucket my-bucket
s3headersetter -config config-sample.yml -bucket my-bucket -key-prefix www

Acknowledgements

This project uses the following packages:

Licence, credit & sponsorship

This project is published under the MIT Licence.

You don't owe me anything in return, but as an indie freelance coder there are two things I'd appreciate:

  • Credit. If your app or documentation has a credits page, please consider mentioning the projects you use.
  • Cash. If you want and are able to support future development, please consider becoming a patron or buying me a coffee. Thank you!
You can’t perform that action at this time.