AWS SQS Allow Cross-Origin Access
<p>I have a javascript used on domains that are not mine. That sends a CORS request out to a php file on my server. The php file sets the header "Access-Control-Allow-Origin: *" before processing the data.</p>

<p>Rather than processing the data I would rather send all of these requests direct to an SQS queue. I replaced the link the the PHP file in the js to the direct URL for the queue. I set the queue permission to allow messages from everybody.</p>

<p>When using chrome, everything works. When using firefox, it throws the following error: </p>

<pre><code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sqs.us-east-1.amazonaws.com/ ... . (Reason: CORS header 'Access-Control-Allow-Origin' does not match '*').
</code></pre>

<p>Can I set header response for an SQS queue? I haven't found anything in the documentation or anyone else doing this but it seems like it should be possible if I can give the SQS queue public access.</p>

<p><strong>EDIT</strong></p>

<p>Here's the call to SQS:</p>

<pre><code>    var urlString = 'ver='+version;
    var url = 'https://sqs.us-east-1.amazonaws.com/####/Sqs_Queue?Action=SendMessage&amp;MessageBody='+encodeURIComponent(urlString);
    var method = 'GET';
    if (navigator.sendBeacon) {
        navigator.sendBeacon(url, null);    
    }
    else{
        var xhr = new XMLHttpRequest();
        if("withCredentials" in xhr) {
            xhr.open(method, url, true);
        }
        else if (typeof XDomainRequest != "undefined"){
            xhr = new XDomainRequest();
            xhr.open(method, url);
        }
        else {
            // CORS not supported.
            xhr = null;
        }
        if (!xhr){
            return;
        }
        xhr.send();
    }
</code></pre>