Quantcast

Linking to another website from Dojo

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Linking to another website from Dojo

Harry Devine
I am putting together a site that has a tree control in it.  One of the nodes is to be a link to site on another server within our IP scheme (my machine is 172.26.xxx.xxx and the other machine is 172.26.xxx.yyy).  I am trying to use dojo/request to accomplish this but I consistently get the error "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://172.26.xxx.yyy.  (Reason: CORS header 'Access-Control-Allow-Origin' missing)."

My code is as follows:

request("http://172.26.xxx.yyy", {
  headers: {
    "Access-Control-Allow-Origin": true,
    "X-Requested-With": null,
    "Content-Type" : "text/html"
  }
});

I have been Googling and what I've found is either old, or tells me to set the X-Requested-With header as above, but I still get the error.  I am using 1.10.4 of Dojo.

Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?

Thanks,
Harry

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking to another website from Dojo

Arnd Beissner
Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?

Practically everything that has to be done on the client side is already implemented by modern browsers. I have used CORS with the Dojo request module successfully out of the box. However, the server side needs to handle CORS correctly. That can be done using a servlet filter for example, if you are using a JEE server. You also need to make sure the HTTP OPTIONS method goes through - it’s not enabled by default everywhere, and OPTIONS is required for CORS preflight requests that your browser will issue.

The message you get implies that the service you are calling is not dealing with the CORS headers, so your browser denies the request.

Am 22.04.2016 um 20:58 schrieb Harry Devine <[hidden email]>:

I am putting together a site that has a tree control in it.  One of the nodes is to be a link to site on another server within our IP scheme (my machine is 172.26.xxx.xxx and the other machine is 172.26.xxx.yyy).  I am trying to use dojo/request to accomplish this but I consistently get the error "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://172.26.xxx.yyy.  (Reason: CORS header 'Access-Control-Allow-Origin' missing)."

My code is as follows:

  headers: {
    "Access-Control-Allow-Origin": true,
    "X-Requested-With": null,
    "Content-Type" : "text/html"
  }
});

I have been Googling and what I've found is either old, or tells me to set the X-Requested-With header as above, but I still get the error.  I am using 1.10.4 of Dojo.

Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?

Thanks,
Harry
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking to another website from Dojo

Harry Devine
Its simply a web server on another machine (which happens to be Windows, so IIS is in play).  So is there something in IIS that I have to set to allow this?

Thanks,
Harry


From: "Arnd Beissner" <[hidden email]>
To: [hidden email]
Sent: Friday, April 22, 2016 3:22:47 PM
Subject: Re: [Dojo-interest] Linking to another website from Dojo

Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?

Practically everything that has to be done on the client side is already implemented by modern browsers. I have used CORS with the Dojo request module successfully out of the box. However, the server side needs to handle CORS correctly. That can be done using a servlet filter for example, if you are using a JEE server. You also need to make sure the HTTP OPTIONS method goes through - it’s not enabled by default everywhere, and OPTIONS is required for CORS preflight requests that your browser will issue.

The message you get implies that the service you are calling is not dealing with the CORS headers, so your browser denies the request.

Am 22.04.2016 um 20:58 schrieb Harry Devine <[hidden email]>:

I am putting together a site that has a tree control in it.  One of the nodes is to be a link to site on another server within our IP scheme (my machine is 172.26.xxx.xxx and the other machine is 172.26.xxx.yyy).  I am trying to use dojo/request to accomplish this but I consistently get the error "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://172.26.xxx.yyy.  (Reason: CORS header 'Access-Control-Allow-Origin' missing)."

My code is as follows:

  headers: {
    "Access-Control-Allow-Origin": true,
    "X-Requested-With": null,
    "Content-Type" : "text/html"
  }
});

I have been Googling and what I've found is either old, or tells me to set the X-Requested-With header as above, but I still get the error.  I am using 1.10.4 of Dojo.

Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?

Thanks,
Harry
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking to another website from Dojo

Arnd Beissner
Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?
Sorry to say this is not a trivial undertaking depending on your needs, not a Dojo issue, and beyond the scope of this list, I think. In very simple cases (no authentication, not all methods) you can get away with just setting the Access-Control-Allow-Origin header to „*“ on the server side on all responses.

As a first pointer for more information try http://enable-cors.org/ . 

Am 22.04.2016 um 21:32 schrieb Harry Devine <[hidden email]>:

Its simply a web server on another machine (which happens to be Windows, so IIS is in play).  So is there something in IIS that I have to set to allow this?

Thanks,
Harry


From: "Arnd Beissner" <[hidden email]>
To: [hidden email]
Sent: Friday, April 22, 2016 3:22:47 PM
Subject: Re: [Dojo-interest] Linking to another website from Dojo

Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?

Practically everything that has to be done on the client side is already implemented by modern browsers. I have used CORS with the Dojo request module successfully out of the box. However, the server side needs to handle CORS correctly. That can be done using a servlet filter for example, if you are using a JEE server. You also need to make sure the HTTP OPTIONS method goes through - it’s not enabled by default everywhere, and OPTIONS is required for CORS preflight requests that your browser will issue.

The message you get implies that the service you are calling is not dealing with the CORS headers, so your browser denies the request.

Am 22.04.2016 um 20:58 schrieb Harry Devine <[hidden email]>:

I am putting together a site that has a tree control in it.  One of the nodes is to be a link to site on another server within our IP scheme (my machine is 172.26.xxx.xxx and the other machine is 172.26.xxx.yyy).  I am trying to use dojo/request to accomplish this but I consistently get the error "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://172.26.xxx.yyy.  (Reason: CORS header 'Access-Control-Allow-Origin' missing)."

My code is as follows:

  headers: {
    "Access-Control-Allow-Origin": true,
    "X-Requested-With": null,
    "Content-Type" : "text/html"
  }
});

I have been Googling and what I've found is either old, or tells me to set the X-Requested-With header as above, but I still get the error.  I am using 1.10.4 of Dojo.

Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?

Thanks,
Harry
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linking to another website from Dojo

Harry Devine
In reply to this post by Arnd Beissner
I just checked my IIS server (7.5) and Access-Control-Allow-Origin is set to *, yet I still get the error.  Where do I go from here?

Harry


From: "Arnd Beissner" <[hidden email]>
To: [hidden email]
Sent: Friday, April 22, 2016 3:22:47 PM
Subject: Re: [Dojo-interest] Linking to another website from Dojo

Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?

Practically everything that has to be done on the client side is already implemented by modern browsers. I have used CORS with the Dojo request module successfully out of the box. However, the server side needs to handle CORS correctly. That can be done using a servlet filter for example, if you are using a JEE server. You also need to make sure the HTTP OPTIONS method goes through - it’s not enabled by default everywhere, and OPTIONS is required for CORS preflight requests that your browser will issue.

The message you get implies that the service you are calling is not dealing with the CORS headers, so your browser denies the request.

Am 22.04.2016 um 20:58 schrieb Harry Devine <[hidden email]>:

I am putting together a site that has a tree control in it.  One of the nodes is to be a link to site on another server within our IP scheme (my machine is 172.26.xxx.xxx and the other machine is 172.26.xxx.yyy).  I am trying to use dojo/request to accomplish this but I consistently get the error "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://172.26.xxx.yyy.  (Reason: CORS header 'Access-Control-Allow-Origin' missing)."

My code is as follows:

  headers: {
    "Access-Control-Allow-Origin": true,
    "X-Requested-With": null,
    "Content-Type" : "text/html"
  }
});

I have been Googling and what I've found is either old, or tells me to set the X-Requested-With header as above, but I still get the error.  I am using 1.10.4 of Dojo.

Any ideas on how to achieve this?  Is it something on the Web server of the remote machine that I have to set?

Thanks,
Harry
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...