Mobile Proxy Servers

Many mobile data services implement a forced cache on access to port 80. These caches often have the unfortunate assumption that the access comes from a web browser, and that a human being will look at the page. Vodafone completely reformats page content, while T-Mobile simply recompresses images at a lower quality. For a human user, this can be a nuisance. For an embedded application, content transformation can be far more serious.

There are several workarounds possible:

  • Use SSL. This completely avoids the problem, at the cost of extra data transfer and a longer setup time.
  • Arrange with your mobile data provider to turn off content transformation for your SIMs, or for accesses to your server. It can take a long time to find the right person to arrange this, and the process has to be repeated for every network you use in every country.
  • Add a Cache-Control header to your http requests, and set a meaningful User-Agent header.

The Cache-Control No-Transform directive tells HTTP 1.1 proxies not to alter the data, and all the current mobile web proxies respect it. The header can be set both on the request from the client and on the response from the server. The header only adds a few bytes to the request, and doesn’t prevent simple caching of the response.

Content transforming proxies will look at the User-Agent header when deciding on formats. A User-Agent unique to your application will reduce the chance of the proxy mistaking the application for a browser.

Both of these headers are easily modified with common HTTP libraries, including libcurl and libwww-perl.