Allow "Content-Encoding" header for CORS preflight request


I’ve been experimenting with zlib compression on the client, so that I’m sending much smaller amounts of data to Sentry. I use raven-for-redux to include my Redux state as context, and I was trying to see if I could use zlib/gzip compression to avoid the 200KB limit. But then I realized that even if I can’t avoid the 200KB limit with compression, it would still be a good idea to compress requests so that the client doesn’t need to send as much data.

I have some proof-of-concept code here that seems to work, but the only problem is that it fails the CORS preflight request from Sentry, because Content-Encoding is not an allowed header. But I noticed that many backend Raven clients are sending the requests with gzip compression, so it would be great if we could also do this from the browser.

(I managed to fix the root cause of my large requests, by removing all the history from redux-undo.)

This is related to my work on handling 413 “request too large” responses from Sentry. I’ve also been working on some code that checks the request length and removes all the state if the request would be too large: