Api rest CWP with error in CORS

Started by dinho, February 07, 2022, 05:06:48 PM

Previous topic - Next topic

dinho

I'm developing an interface that uses the Api rest of the CWP, however, even putting % in the origin of the Apimanager settings, it still has CORS errors.
Does anyone know how to disable cors for API?

rcschaff

#1
First, There is no way to disable CORS in modern browsers...

Did you try * instead of %?  CORS will read * as allow any.  (Please try this first)

Aside from that, you may need to tweak settings in the API config files

vi /usr/local/cwpsrv/conf.d/api.conf

Add the following line right after error_log
add_header Access-Control-Allow-Origin *;

Please note that you will have to fix this each time you update CWP.

Once that is done

/usr/local/cwpsrv/bin/cwpsrv -s reload

Google Hangouts:  rcschaff82@gmail.com