RestAPI Cors Problem
I'm building a Flutter app for smartphones and with same code a Flutter web app.
Both are using IRIS with a RestAPI.
As described in your documentation
I added
- "x-ISC_DispatchParent":"solidara.CorsDispatch"
in the Info block of the Swagger definition and added
- Parameter HandleCorsRequest = 1;
in the spec file after generating the RestAPI.
I also copied the example dispatch class to
- Class solidara.CorsDispatch
With the Android app on my smartphone the OnHandleCorsRequest() is called although the cors data are not set by the request and handling a cors request is not needed. I can see this by setting a global in this method showing the %request.CgiEnvs sent by the app. The data access from the app to IRIS is working as expected.
But in Flutter Web I always get the Cors Error:
- Access to XMLHttpRequest at 'http://solidara.net:52773/csp/solidara/get/solidara' from origin 'http://app.solidara.net' has been blocked by CORS policy:
- Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
and the OnHandleCorsRequest() is not called at all by IRIS!
Any idea, what's going wrong here?