Skip to content

Conversation

mhluska
Copy link

@mhluska mhluska commented Aug 29, 2018

In my case the cache wasn't working because res.send was never being called (thus cache.put was never called).

After changing the implementation to use res.write and res.end and getting it to work, I noticed that the cache can only be used for caching text/html resources because the res.send() call for a cache hit will overwrite the content type, regardless of what type it is storing (css, js etc). So you have to be careful to have a cache implementation that rejects a promise during the fetch call if the content type is any besides text/html.

Also, the cache middleware has to go before gzip otherwise gzip doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant