Is there a way to set the allowed origins for the manage REST API? I am working on an interface to make the requests from the browser but CORS is blocking my request.
Thanks
Is there a way to set the allowed origins for the manage REST API? I am working on an interface to make the requests from the browser but CORS is blocking my request.
Thanks
Officially supported, no. But for a one-off you can do it if you’re willing to edit the nginx configuration file for groov Manage. You’ll need to open up /etc/nginx/sites-enabled/http/opto/manage.nginx.conf
and find the Public API section. In the location /manage/public/api
block add this line:
add_header Access-Control-Allow-Origin "https://www.example.com";
Replacing www.example.com with your application’s hostname. Restart nginx (systemctl reload nginx
on 4.0.0 and newer, /etc/init.d/nginx restart
on earlier releases) and it should work.
It’s not a complete and proper implementation: it can only support a single origin and doesn’t do any checking within Manage’s code, but it’ll allow your requests to get through for now.