Published on InterSystems Developer Community (https://community.intersystems.com)

Home > CORS in REST service when using Maps

Question
Michele De Chiffre · Mar 11, 2021

CORS in REST service when using Maps

I'm trying to setup a REST server with CORS support. I have created a class that handles a specific part of the service (printer control). This class I have referenced in my main REST class by adding <Map Prefix="/print" Forward="myClass.PrintAPI" />

My main class does have its own <Route>s and handles CORS requests perfectly. But in my subclass OnHandleCorsRequest() is only run when requesting from same origin and never run when making a CORS request. I have set Parameter HandleCorsRequest = "true" in both my main REST class and the subclass.

 

Can anyone point me in the right direction on what might be the problem or which alternative methods I should use and run?

#Mapping #REST API #InterSystems IRIS
Product version: IRIS 2020.2
$ZV: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2020.2 (Build 211U) Fri Jun 26 2020 13:48:12 EDT

Source URL:https://community.intersystems.com/post/cors-rest-service-when-using-maps