CNAME works for nslookup but not curl

I have created two CNAMEs for my (CloudFront) domains, like this:

enter image description here

nslookup works, giving me the correct values for both www and d-test — but when I actually get the data, using curl or a browser, all data is retrieved from the origin pointed to by www, regardless of which URL I actually use. If I use the origin URLs, it works fine.

How is this even possible?