Skip to main content

I am currently contemplating an architecture for allowing JavaScript based access to data. I would like to take advantage of smartobjects. In looking at various libraries like Angular, I was hoping to be able to bind to the REST end points generated by K2. With everything on one machine it is okay. But I have K2 installed on separate servers in production, so that results in cross domain requests if the app is hosted on an app server elsewhere. That in turn results in the browser prompting because of the request.

The labs have said that the SmartObject REST end points don't implement CORS so I can't talk directly to them. So now I am wondering if I am going to have to proxy the smartobjects using WebAPI and use the .Net API to all the smartobjects to get it to work.

I would like to ask if others have implemented something like this? If so, what techniques have you used to achieve access without the browser prompting?

Thanks

Jeremy

I am looking at something similar so would like to know if this is possible. It seems a shame to have to create essentially a wrapper around the existing REST endpoints to implement the relatively common requirement of Cross Domain AJAX requests. I don't really want to run K2 and all my other internal web applications from one single domain - this is potentially an option for live situations at a push, but it's really not practical while in development. So I would also be interested to see what people have done or what the suggested best practice approach is for this type of architecture (i.e. Angular.js, Jquery ajax, etc.). I am currently looking at using Workflow UpdateTask endpoint rather the SmartObject service but the same principal applies.


I am with you and the fact that SmartObject REST end points don't implement CORS makes them abolsutely useless...

 

I also wanted to use Angular and Polymer but I am afraid I am left with no option.

CORS does not work, JSONP is not supported as well.

 

I would love to actually understand the reason why this is not available.

At least, for the K2Services, you can add custom headers but afaik this is not possible for the SmartObjectServices.

 

If anyone made progress or has a trick, I would love to hear about it.

I am not to crazy about re-implementing a proxy on what is supposed to be a standard interface.


There is by the way a piece of documentation that sounds good:

http://help.k2.com/onlinehelp/k2blackpearl/devref/4.6.4/webframe.html#configuration2.html

 

but no matter if you set enableCrossDomainPolicy to true or false, the header of the response never contains Access-Control-Allow-Origin.


Reply