I am currently having an issue regarding CORS (Cross-origin resource sharing) the odd thing being this only seems to happen when i prefix my url using www.
For example when i go to my website using the url: "http://example.com/index" everything works fine and all resources are loaded correctly. however when i try to visit my website using the url "http://www.example.com/index" i get the error Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://example.com/index. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
The resource i am trying to load is an XML file using the following code:
function loadXML()
{
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
xmlData = xhttp.responseXML;
initStartShot();
}
};
xhttp.open("GET", "http://example.com/XML/someXMLfile.xml", true);
xhttp.send();
}
all my resource files are on the same domain as my page.
i have looked around SO for issues related to mine, but most are about CORS in general, and how to get it to work. but seeing the fact i'm not having any CORS issues without "www" prefixed this doesn't seem applicable to my issue.
Unfortunately I am unable to share the url itself, but if you require any other information i'll do my best to provide it.
Any help would be greatly appreciated.
~Remy