fusio-docker icon indicating copy to clipboard operation
fusio-docker copied to clipboard

CORS issue with basic docker-compose up -d

Open MattCrum1 opened this issue 3 years ago • 5 comments

Hi - I've tried using the latest docker-compose to stand up an instance of this - attempting to log in with the backend user and password from the docker-compose file and keep getting a CORS error in the browser console - it says it is connecting to this URL: http://api.fusio.cloud:8080/authorization/token

Can we please confirm which version to use for a stable evaluation system?

Would you recommend using the Docker image for a production requirement? If so, are there any additional things to change other than the default credentials?

MattCrum1 avatar Jul 12 '21 12:07 MattCrum1

Hi, so you probably need to use https instead of http, this should resolve the CORS issues, otherwise you can also adjust the protocol through the env properties. So in general it always dependes a little bit on your preferences but you can also run Fusio on a bare metal LAMP stack.

chriskapp avatar Jul 12 '21 22:07 chriskapp

Hi Chris - thanks for the response.

Not quite sure what you mean here - I am using http://[ip-address]/apps/fusio to connect to my instance - the docker-compose file here does not expose a HTTPS port (only HTTP on 8080)...?

https://github.com/apioo/fusio-docker/blob/master/docker-compose.yml.

In order to evaluate the system, I did the following on a Centos7 server:

  • Cloned the repository https://github.com/apioo/fusio-docker.git (into /opt/fusio-docker)
  • Ran docker-compose up -d in that directory (no changes to any files)
  • Connected to http://[ip-address]/apps/fusio - the backend GUI appears
  • Attempted to log in with "demo" and the password in the docker-compose file. No feedback in the GUI; the browser console shows this:

image

  • There are loads of SQL errors in the docker logs

An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused

  • It also shows this
fusio_1        | In Authenticator.php line 181:
fusio_1        |
fusio_1        |   Found no existing token, please request a token through the login command

Should I be updating the URLs in the docker-compose file to match my server's hostname and/or doing anything else to get it to work (i.e. should I not be using the Master version)?

If so, can the README.md file be updated to reflect how to stand up a stable instance for evaluation / production?

MattCrum1 avatar Jul 13 '21 09:07 MattCrum1

@MattCrum1 Had same issue, when Screenshot_31 I guess this image is attempting to grab a token from http://api.fusio.cloud:8080

yasir2000 avatar Jul 22 '21 12:07 yasir2000

@MattCrum1 Had same issue, when Screenshot_31 I guess this image is attempting to grab a token from http://api.fusio.cloud:8080

same here.

i am able to login if change public/apps/fusio/index.html where fusio app base url is set:

for example i am hosting on localhost:8080 fusioProvider.setBaseUrl('http://localhost:8080/');

Yrds avatar Aug 10 '21 18:08 Yrds

Ok, also for the future, this problem occurs if you run docker-compose up -d and the docker-compose.yml file does not contain the correct FUSIO_URL, in this case the container will install the backend app etc. and write the wrong URL to the index.html file. If you then later fix this URL at the env file then it will not update the URL at the index.html file since the app is already installed. In newer versions of the docker image we have removed the volume to public/ folder since we can now configure all settings through the backend, this means also that we should not run in this issue anymore.

chriskapp avatar Feb 13 '22 18:02 chriskapp