Skip to content

Removal of header "Content-Encoding" for cached items - but still compressed body #2

@axelhahn

Description

@axelhahn

Hi,

we currently experiment with your traefik caching plugin.
It ignores default http caching information and "just caches" all requests if we want.

We have the problem that a container deliveres text data incl. gzip compression.
With your enabled cache plugin the first request deliveres the original response to the client and stores a cache item in memcache.

The 2nd request finds the cached item and deliveres it ... BUT:
It does not add the "content-encoding: gzip" and sends a gzip compressed body. In a webbrowser you then you see only some binary stuff.

I cannot write go ... but I saw in main.go line 191 https://github.com/ghnexpress/traefik-cache/blob/main/main.go#L191 that just the header will be removed r.Header().Del("Content-Encoding") but the gzip encoded body is still compressed - and written to to memcache.

The "Content-Encoding" header shouldn't be removed without uncompressing the body data before caching (requires to implement compressing methods, like gzip, br).
Can you keep the field "Content-Encoding" in the cache item (and it must be included in the hashsum too)?

Regards,
Axel

Metadata

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