Re: [squid-users] Are you on mobile/handset?

From: Chris Woodfield <rekoil_at_semihuman.com>
Date: Thu, 18 Jun 2009 15:51:20 -0400

Since we're on the subject, a couple points to share...

1. If you're delivering unique objects based on the User-Agent, make
sure that you either mark the content no-cache, or make sure that each
different object has a unique ETag. IIRC, Adding Vary: User-Agent is
mandatory as well if you're expecting the object to be cached, except
that that creates a big potential failure case I'll illustrate below.

A far better idea is to issue a 301 Redirect to user-agent-specific
sites (mobile.site.com, for example), or use javascript to branch on
navigator.userAgent to avoid having to serve unique objects for
different UAs in the first place. Option #2 may be impossible due to
object size reasons (I know flickr wasn't able to do it, they had to
use the 301 option to send a mobile-specific .js and .css), so pick
what works best for you.

2. If you are behind a squid reverse proxy with broken_vary_encoding
turned on (often necessary, thanks apache and lighttpd), do NOT send
Vary: User-Agent from the origin on a cacheable object. You will wind
up with a unique object in the cache for every unique variation of the
client User-Agent string (which, in my horror-story example, numbered
in the tens of thousands for a moderately popular site). Not a
pleasant tale to tell.

HTH,

-Chris

On Jun 16, 2009, at 11:21 PM, Amos Jeffries wrote:

> On Tue, 16 Jun 2009 08:05:17 +0200, Luis Daniel Lucio Quiroz
> <luis.daniel.lucio_at_gmail.com> wrote:
>> Hi Squids,
>>
>> How do you think should be the best way to detect if a user is
>> surfing
> inet
>>
>> throut its mobile/handset?
>>
>> TIA
>>
>> LD
>
> Pretty much the purpose of the User-Agent: header.
>
> Amos
>
Received on Thu Jun 18 2009 - 19:51:33 MDT

This archive was generated by hypermail 2.2.0 : Fri Jun 19 2009 - 12:00:03 MDT