Global Directory
Global Directory
EXPLORE OUR SITES
London Stock Exchange Group
LSEG Data & Analytics
MyAccount
LSEG Perspectives
London Stock Exchange
FTSE Russell
LCH
Contact Us
Home
TR Internal
Has anyone in TR enabled CORS in their app?
matt.dimich
Does anyone allow "cross site" requests using CORS (Cross Origin Resource Sharing) today? If so, what benefits and risks have you found in the process?
Find more posts tagged with
ajax
refinitiv-internal
Accepted answers
john.duprey
The NewsPlus news recommendation service is CORS enabled and accessible through API garden as such. This *is* a dev/POC-level service, though. I'm in R&D after all.
That said..
In a service oriented world, its hard to imagine **NOT** calling out to at least *some* services that are served by a different domain.
**Benefit**: As a service provider, you make your service more accessible to a greater audience. It decouples application environment**S** (emphasis on the plural) from the service environment - a must have if you are providing the service across multiple groups or organizations. (API Garden users, there's a little extra configuration on the proxy side to let your CORS proxy through.. I don't have the details, right now, but its pretty straightforward.)
**Benefit**: As a front-end application, its often necessary to pull in functionality from many different services hosted across or outside of the organization. CORS is the new way to do this across domains. The other alternative is JSONP which has its limitations.
**Risk**: The user's browser has to support CORS. Most modern browsers do. See
@john-ericson
's answer about IE compatibility - see here for a compatibility chart: [
http://caniuse.com/cors][5]
and the article he cites - [
http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx][6]
.
**Risk**: You may have more apps/things talking to your service than initially planned. You can mitigate this in your CORS settings by only allowing certain domains access - e.g. all *.thomsonreutes.com and *.westgroup.com, etc. You can also mitigate it by restricting access through API keys - like those that API Garden can provide.
----
More details...
Browser security doesn't allow cross domain AJAX calls without some extra HTTP hand-shaking between the browser and the service - [
http://en.wikipedia.org/wiki/Same_origin_policy][1]
.
There are two ways that I'm aware of to make AJAX calls outside of the domain my "document" was served by:
- JSONP - [
http://en.wikipedia.org/wiki/JSONP][2]
- CORS - [
http://en.wikipedia.org/wiki/Cross-origin_resource_sharing][3]
JSONP is the old way, has limitations in what it can do and how errors can be handled. CORS is the newer and cooler way is gives you all the functionality of a same domain service.
I learned about this in 2012 and here are my notes:
[
https://thehub.thomsonreuters.com/blogs/lostandfound/2012/03/13/making-you-tomcat-services-cross-origin-capable][4]
[1]:
http://en.wikipedia.org/wiki/Same_origin_policy
[2]:
http://en.wikipedia.org/wiki/JSONP
[3]:
http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
[4]:
https://thehub.thomsonreuters.com/blogs/lostandfound/2012/03/13/making-you-tomcat-services-cross-origin-capable
[5]:
http://caniuse.com/cors
[6]:
http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
All comments
John Ericson
We started to, from the perspective of consuming services via XHR, but then found limitations in IE9 (and lower). Specifically that it won't support auth headers. Here are some details about IE8, but most apply to IE9 as well.
http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
john.duprey
The NewsPlus news recommendation service is CORS enabled and accessible through API garden as such. This *is* a dev/POC-level service, though. I'm in R&D after all.
That said..
In a service oriented world, its hard to imagine **NOT** calling out to at least *some* services that are served by a different domain.
**Benefit**: As a service provider, you make your service more accessible to a greater audience. It decouples application environment**S** (emphasis on the plural) from the service environment - a must have if you are providing the service across multiple groups or organizations. (API Garden users, there's a little extra configuration on the proxy side to let your CORS proxy through.. I don't have the details, right now, but its pretty straightforward.)
**Benefit**: As a front-end application, its often necessary to pull in functionality from many different services hosted across or outside of the organization. CORS is the new way to do this across domains. The other alternative is JSONP which has its limitations.
**Risk**: The user's browser has to support CORS. Most modern browsers do. See
@john-ericson
's answer about IE compatibility - see here for a compatibility chart: [
http://caniuse.com/cors][5]
and the article he cites - [
http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx][6]
.
**Risk**: You may have more apps/things talking to your service than initially planned. You can mitigate this in your CORS settings by only allowing certain domains access - e.g. all *.thomsonreutes.com and *.westgroup.com, etc. You can also mitigate it by restricting access through API keys - like those that API Garden can provide.
----
More details...
Browser security doesn't allow cross domain AJAX calls without some extra HTTP hand-shaking between the browser and the service - [
http://en.wikipedia.org/wiki/Same_origin_policy][1]
.
There are two ways that I'm aware of to make AJAX calls outside of the domain my "document" was served by:
- JSONP - [
http://en.wikipedia.org/wiki/JSONP][2]
- CORS - [
http://en.wikipedia.org/wiki/Cross-origin_resource_sharing][3]
JSONP is the old way, has limitations in what it can do and how errors can be handled. CORS is the newer and cooler way is gives you all the functionality of a same domain service.
I learned about this in 2012 and here are my notes:
[
https://thehub.thomsonreuters.com/blogs/lostandfound/2012/03/13/making-you-tomcat-services-cross-origin-capable][4]
[1]:
http://en.wikipedia.org/wiki/Same_origin_policy
[2]:
http://en.wikipedia.org/wiki/JSONP
[3]:
http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
[4]:
https://thehub.thomsonreuters.com/blogs/lostandfound/2012/03/13/making-you-tomcat-services-cross-origin-capable
[5]:
http://caniuse.com/cors
[6]:
http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
Quick Links
All Forums
Recent Questions
Terms of use
Privacy & Cookie Statement
Cookies settings
Do not sell my info
Whistleblowing
UK Bribery Act
Modern Slavery Act