ansible-community / ara-web

Stateless web client for the ARA Records Ansible API.
https://ara.recordsansible.org
GNU General Public License v3.0
37 stars 8 forks source link

CORS Issues - can't resolve #18

Closed markfaine closed 4 years ago

markfaine commented 4 years ago

I have ara-web running in a container, ara-api in another container and I'm using a third container for proxying with nginx.

See the attached image. It seems that nothing that I do will resolve this issue.

I've even set CORS_ORIGIN_ALLOW_ALL: true and yet I still get the same message.

I have shelled into the ara-web container and I can telnet to ara-api on port 8000.

I intended for it to not proxy the api commands, since that would be a pain, but to send them directly to the api server. http://ara-api:8000, however, I have not been able to successfully connect, as show in the attached image.

I would appreciate any suggestions on how to resolve this issue.

image

dmsimard commented 4 years ago

Hi @markfaine and thanks for the report !

ara-web provides it's own API client implementation and, unless mistaken, the API queries are sent from your browser -- not by the backend server.

My understanding is that even if the ara-web container can resolve and query ara-api:8000, if your browser can't, then it probably won't work.

Are you able to access http://ara-api:8000/ directly from your browser ? Is there any messages in the javascript console window ?

Thanks !

markfaine commented 4 years ago

Thanks, I guess that makes sense. No, I can't access it directly with my browser.

The console has:

Blocked loading mixed active content “http://ara-api:8000/api/v1/” Error: "Network Error" exports createError.js:17 onerror xhr.js:69 App.js:29:18 Blocked loading mixed active content “http://ara-api:8000/api/v1/playbooks” playbooks:1:773

dmsimard commented 4 years ago

Thanks, I guess that makes sense. No, I can't access it directly with my browser.

Is it intentional ? Can you make it available and see if it works ?

markfaine commented 4 years ago

I can't make it available as is but I can proxy it through nginx and configure a different url in config.json. I'm trying that now.

markfaine commented 4 years ago

That worked. At least, I think. The problem now is that there are no tables:

Is there a way to initialize the database, I'm using mysql.

MySQLdb._exceptions.ProgrammingError: (1146, "Table 'ara.playbooks' doesn't exist")

markfaine commented 4 years ago

Seems to be resolved, I'll close this now.

dmsimard commented 4 years ago

That worked. At least, I think. The problem now is that there are no tables:

Is there a way to initialize the database, I'm using mysql.

MySQLdb._exceptions.ProgrammingError: (1146, "Table 'ara.playbooks' doesn't exist")

Yes -- this is done by the "ara-manage migrate" command from where the API server is configured.