Cross Domain XMLHttpRequest using CORS or Web Proxy

415 views Asked by At

My client has a very specific technical issue they have asked us to find a resource for. It is very specific, so I was wondering if anyone could steer us in the right direction (so I can steer them).

They are trying to do a XMLHttpRequest to a different domain than the page is on in order to talk to a third party BI site that they want to access. When they try to access the third party BI site within their website, it breaks and does not pull up the site. The browser is blocking it as it usually allows a request in the same origin for security reasons. They have been told that they need to do something different when they want to do a cross-domain request using CORS. Or should they use Web proxy? Or another method?

How would they go about starting to resolve this with no experience in either area?

Our client's site is primarily written in PHP/JavaScript and this would be a huge help for a problem they have been trying to fix for about two weeks.

Thoughts?

1

There are 1 answers

1
Arun Krish On

We got the same problem when we accessed fonts from our sub domain. And finally we added the following in .htaccess and it worked for us.

<ifmodule mod_expires.c>
    <Filesmatch "\.(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>