Chrome data compression proxy and DWR

2019-05-24 10:28发布

问题:

We are developing a web mobile application using DWR as Ajax framework and we are getting errors in Nexus 4 devices which have enabled the option Reduce data usage in the Bandwidth Management setting. The error displays an alert saying Error 502: Bad gateway and it happens when refreshing a page that calls a DWR method in the onload event.

回答1:

(I am the lead on the Chrome data compression proxy.)

The problem is a bug in the DWR library which uses JavaScript comments to contain semantically-meaningful content. The Chrome data compression proxy removes JS comments, which it is allowed to do by the headers; the fix is for DWR to use "Cache-Control: no-transform" in the DWR response headers. I emailed the DWR dev list a while back to ask about this but never heard back. We are looking for a general purpose workaround but in the meantime there's no easy fix unless DWR is fixed to work through HTTP proxies.