Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cache #89

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix cache #89

wants to merge 3 commits into from

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.

None yet

1 participant