Author Topic: Api rest CWP with error in CORS  (Read 567 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Api rest CWP with error in CORS
« on: February 07, 2022, 05:06:48 PM »
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?

Offline
****
Re: Api rest CWP with error in CORS
« Reply #1 on: February 08, 2022, 01:56:20 PM »
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

« Last Edit: February 08, 2022, 01:58:19 PM by rcschaff »
Google Hangouts:  rcschaff82@gmail.com