What is the correct syntax for listing multiple domains to be allowed for cross-domain AJAX calls? My code does this:
<?php
header("Access-Control-Allow-Origin: http://website.com");
This works when website.com is the caller, but not when www.website.com is the caller. So I tried:
<?php
header("Access-Control-Allow-Origin: http://website.com http://www.website.com");
... and...
<?php
header("Access-Control-Allow-Origin: http://website.com, http://www.website.com");
But these things don't work. When I say they don't work, I mean that neither website.com nor www.website.com will be able to make the call with those configurations. So right now the only option is to put * and allow everything. I don't want to do that.
Is there another header directive or something that I need? I saw something about Access-Control-Allow-Headers: X-Requested-With but that didn't work either.