Skip to main content


 

Symptoms

 


CORS header in SmartObject REST service Response Header.
 

 

Diagnoses

 


K2 does not currently support CORS header in SmartObject REST service Response Header.
 

 

Resolution

CORS settings for the SmartObject REST services are not supported. The reason for this, is that the REST service is hosted in the host server, instead of IIS which means there is no web.config file to configure CORS settings. There is also no config entry that you can set in the K2HostServer.exe.config file to configure CORS. CORS is enforced by browsers. So if you have a site that is in a different domain, one way to get past the CORS limitation is to make the REST call server side with no browser/client interaction, and then pass the results back to the client.



 

Hi,

 

Is there any documentation on the new SmartObject endpoint services (hosted in IIS) for 4.7?

 

The only thing I can find on SMO web services for 4.7 is the following:

 

http://help.k2.com/onlinehelp/k2blackpearl/devref/4.7/default.htm#Configuration2.html

 

This appears to be exactly the same as before, i.e. still not hosted in IIS and therefore no way of enabling CORS.

 

Is this something that was intended for 4.7 but subsequently not included?  If so then will it be included in 4.7.1 or a later release?


Did you ever find a solution to this?


@usmansadjid As far as I know it is not encluded even in K2 Five, but in K2 Five you can use OData services as an alternative approach. If we look at K2 Cloud documentation it seems it has been implemented there for the Workflow REST API, at leat its GUI have all the relevant settings. It probably means that at some point later we can get the same in K2 Five.


We ended up having to install the CORS-anywhere node.js proxy to be able to work around the limitation.  Not pretty (and another piece in the puzzle which makes things more complex which I don't like) however it got us working. 

 

https://github.com/Rob--W/cors-anywhere


Reply