Skip to content

Gzip Support and cache-control headers #12

Open
@SaulDoesCode

Description

It would be very nice to see a golang web framework handle gzip natively and do it well. There are various libraries and middlewares out there which purport a well adjusted and performant solution to serving gzipped content.

I've made a fairly primitive project some time ago, which provides an echo instance with the ability to read, monitor, cache and recache various static assets either within a specified folder or definitively located elsewhere; with this it would determine an asset's compress-ability and compress it thusly, serving it, thereby, only when a client's Accept-Encoding header indicates gzip support.

Desireable Features In a Gzipping Sollution:

  • - Cache Gzipped Assets:

    • In memory, with coffer potentially.
      • watched assets, should, on changes, (asynchronously) re-compress/update a memory/disk backed asset.ext(.gz)
    • On Disk, like some nginx/apache configs permit.
      • eg. route localhost/asset.txt -> first looks for - > ./assets/.cache/asset.txt.gz
    • Client Side, by setting and maintaining the correct cache-control and etag headers.
  • - Compress at the highest level when caching, but automatically scale down with dynamic content.


Air does not seem to handle caching headers, (to my knowledge, I may be wrong), as all my coffer cached assets seem to be missing their cache-control headers. While it would be possible to deliberately add such caching headers, it would certainly also have been nice had the air sub systems managed cache headers when it detected that the higher level user has not set any or has not deliberately disabled cache-control.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions