1
votes

I have a PHP based web application and want to be able to offer mobile users the option to view the content of my site through a dedicated set of 'mobile friendly' pages. The URL structure for the mobile site is different to the desktop site.

The idea is that the first time a mobile user hits the index page, a regexp checks the user agent and if they are a mobile device they are given the option to select to view either the desktop or mobile version of the site.

The problem is that I am caching static HTML with my CDN provider (Cotendo). This means that when the cache is populated the mobile user is likely to see a cached version of the desktop site and bypassing the mobile/desktop option page. It also means that with an empty cache, a mobile user could force the CDN to store the cached version of the mobile/desktop option page!

One option would be to check the user agent at the CDN level and bypass cache retrieval for mobile users. However, a signification proportion of traffic to the site is driven by mobile users and serving non-cached content to mobile users is not currently an option.

1
A easy way to resolve this is to serve the same page with Responsive Design, using media queries. That way one cached page is served to everyone regardless of resolution and you don't have to fiddle with unreliable useragents. - rlemon

1 Answers

1
votes

At the CDN level, can you add a ?mobileoption querystring for mobile devices. Then only show the mobile/desktop option page when that querystring is present.