Webhosting services, such as Squarespace, enable customers to connect their third-party-hosted domains to their site without transferring ownership or switching Nameservers. This is achieved by adding specific records to the dns configuration of the domain itself. Here is what Squarespace requires:
HOST RECORD VALUE 9aa5s43zpykpn cname verify.squarespace.com www cname ext-cust.squarespace.com @ a 188.8.131.52 @ a 184.108.40.206 @ a 220.127.116.11 @ a 18.104.22.168
Presumably, when the domain is visited, the A record connects to the appropriate server, which, using the verify.squarespace.com CNAME record, discerns and directs the request to the proper content based on the unique identifier stashed in the host (9aa5s43zpykpn).
Is this actually how that works and the reason for doing it?
Does verify.squarespace.com get queried as part of the dns resolve? (before squarespace's servers get the request via the A record)
Are there any other purposes at work here for this type of setup?
Why the need for the www record?
Most importantly, what technique would Squarespace be using to actually view the CNAME record for verification? ie, is there an appropriate DNS record for this on their end, or would the server have to identify the incoming host (domain), match and find the associated hash (9aa5s43zpykpn) in a database, and then use a tool like dig to verify the cname record exists?