CDN that supports switching between 2 files, dependant on User-agent
I have a conundrum. I'd like my entire domain to be hosted by CDN. So the root page, www.mysite.com/ should be served by a CDN. This is fine. However I'd like to conditionally serve a different page (or redirect) dependant on whether the user-agent string is detected to be mobile (e.g. like on http://detectmobilebrowser.com/). And I'd like this, if possible, to be done server-side.
I know Cloudfront can serve 2 differ开发者_高级运维ent versions of the same file dependant on the header (gzipped or not), but I can't find any documentation stating if it or any others support any way of switching dependant on the user agent. Anyone come across a way of doing this?
Thanks for any much appreciated help :D,
AlecYour CDN must be able to reply with a HTTP response 301 Moved Permanently based on the User-Agent text parsing results, when the user tries to access the webpage or object you´d like to switch.
A content delivery network (CDN) is more thought to host your static content like images, scripts, media files, documents etc. instead of your entire website.
The meaning is to lighten the load by removing the static content from your origin server as well as serving the static content more locally through a network of servers around the world.
A typical hosting setup for what you would like to do would be to have a page/server hosted at a "normal" provider, detect the user agent (client side oder server side) and then render the links to the static resources hosted on the CDN based on the user agent.
To your second point, as mentioned before CDNs are thought to host static files so server-side detection of the user agent is not likely. If you have a hosting environment like I stated with a page/server at the provider of your choice plus a CDN you'll have all options.
Some providers (e.g. Media Temple) offers CDN support on top of their normal page/server hosting.
Hope that helps.
精彩评论