ember-fastboot / fastboot-app-server

A production-ready app server for running Ember FastBoot apps
140 stars 74 forks source link

Cache middleware fails to intercept response if chunkedResponse is enabled #85

Open reidab opened 6 years ago

reidab commented 6 years ago

When a cache (like https://github.com/tomdale/fastboot-redis-cache) is provided, the Express server builds middleware to read/write cache entries.

To grab responses, it replaces the implementation of res.send with one that stores to the cache here.

When chunked responses are enabled res.write is called instead of res.send, so nothing is ever written to the cache.

Using something like https://github.com/axiomzen/express-interceptor (or implementing similar techniques) would solve this issue.

mhluska commented 5 years ago

@reidab I think that's the exact issue I was having here: https://github.com/ember-fastboot/fastboot-app-server/pull/89. I hacked around it by modifying fasboot-app-server to use res.write and res.end instead of res.send.