responsible-ai-toolbox icon indicating copy to clipboard operation
responsible-ai-toolbox copied to clipboard

ResponsibleAIDashboard CORS origin issue

Open Kandaraa opened this issue 2 years ago • 0 comments

Hello

I'm facing CORS origin issue running ResponsibleAIDashboard on a server. Accessing to local host everything is fine but when I open the port and try to access through the ip public the Error analysis dashboard (of the tree) don't show up and I got these issues in the console of the browser:

1- Access to fetch at 'http://localhost:5000/importances' from origin 'http://xxx.xxx.xxx.xxx:5000' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space local. 2-POST http://localhost:5000/importances net::ERR_FAILED 3-Access to fetch at 'http://localhost:5000/tree' from origin 'http://xxx.xxx.xxx.xxx:5000' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space local. 4-POST http://localhost:5000/tree net::ERR_FAILED

I've tried to modify the local_ipython_environment.py file in rai_core_flask/environments without any result (still have the same issue) . Below is the modification:

`

def select(self, service):

    headers = ['Content-Type'] # i've added this

    service.with_credentials = False

    #service.cors = CORS(service.app) this line was comented and repalced by the line below

    service.cors = CORS(service.app, origins=['http://xxx.xxx.xxx.xxx', 'http://xxx.xxx.xxx.xxx:5000', '*'],expose_headers=headers, supports_credentials=True)

    service.env_name = LOCAL

`

please help how can I allow the CORS Origin?

Thanks in advance

Kandaraa avatar Feb 06 '23 17:02 Kandaraa