I've built a RESTful Api in PHP on a local machine and everything is working perfectly. Preflight requests are sending the correct responses etc, everything handled by PHP is working like a dream.
But if I try to access an image in a public folder (programatically via javascript in this instance) I'm getting the infuriating :
Access to XMLHttpRequest at 'http://localhost/tmp/avatars/user.jpg' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I've set the following in the .htaccess file in the public root dir, and in the MAMP Apache <Directory> and <VirtualHost> directives but it is just refusing to work.
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "*"
CORS is a pain in the arse at the best of times, but this is just ridiculous. Why isn't this working?
Any ideas?