rtfd/readthedocs.org — pull request #639 by ehough (2014-01-23 05:48:56+00:00)
Title: Loosening subdomain detection logic

This is a humble and simple attempt to address #625.

Knowing relatively little about the implications, I would argue that we don't really care if the user arrived via the `settings.PRODUCTION_DOMAIN` domain. If they arrived via a 3-part domain, just take the first part of the domain as the slug. If the project exists, great. If not, RTD will throw up a 404.

This should allow CloudFlare to work without trouble, and it has the additional benefit of greatly reducing CNAME DNS lookups as lines 53 to 71 won't get exec'd unless the CNAME has 4+ parts.