jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 270 forks source link

No 'Access-Control-Allow-Origin' header is present on the requested resource. #85

Closed ankur20us closed 10 years ago

ankur20us commented 10 years ago

I am using this library in the following way, so I have 2 projects of java, 1 as web app project with UI from where I will call one URL hosted on another server to get the JSON as like this

Project No : 1 Have a UI to get the json from a link which we will provide via text field, hosted on Tomcat running on port 9080 this is slave: In this project I have a proxy.html file with this content as :

    <!DOCTYPE html>
    <script src="http://jpillora.com/xdomain/dist/0.6/xdomain.min.js" ></script>
     <script>
         xdomain.slaves({
            'http://localhost:8080/group/v1/docs':'*'
         });
      xdomain.debug = true;
    </script>
    

Project No : 2 The project with the API is running on port 8080, is having the proxy.html as : this is master:

      <!DOCTYPE html>
      <script src="http://jpillora.com/xdomain/dist/0.6/xdomain.min.js" ></script>
      <script>
        xdomain.masters({
          'http://localhost:9080/try/jsondoc.jsp':'*'
        });
        xdomain.debug = true;
      </script>
   
jpillora commented 10 years ago

See the FAQ and then read the API, your master / slave listings must be wrong

On Thursday, June 12, 2014, Ankur notifications@github.com wrote:

I am using this library in the following way, so I have 2 projects of java, 1 as web app project with UI from where I will call one URL hosted on another server to get the JSON as like this

Project No : 1 Have a UI to get the json from a link which we will provide via text field, hosted on Tomcat running on port 9080 this is slave: In this project I have a proxy.html file with this content as :

<!DOCTYPE html>

<script src="http://jpillora.com/xdomain/dist/0.6/xdomain.min.js" ></script>

 <script>

     xdomain.slaves({

        'http://localhost:8080/group/v1/docs':'*'

     });

  xdomain.debug = true;

</script>

Project No : 2 The project with the API is running on port 8080, is having the proxy.html as : this is master:

  <!DOCTYPE html>

  <script src="http://jpillora.com/xdomain/dist/0.6/xdomain.min.js" ></script>

  <script>

    xdomain.masters({

      'http://localhost:9080/try/jsondoc.jsp':'*'

    });

    xdomain.debug = true;

  </script>

— Reply to this email directly or view it on GitHub https://github.com/jpillora/xdomain/issues/85.

ankur20us commented 10 years ago

I tried in both ways, kept the proxy html in Project 1 with master config and for slave config and vice versa for my Project 2, but the issue remains the same. Do I have to do any other configurationin Chrome?

ankur20us commented 10 years ago

hey, its solved now I am able to get the response, thanks, for this plugin