taigaio / taiga-docker

Mozilla Public License 2.0
1.22k stars 305 forks source link

[Q] Invalid conf.json & CORS issue #8

Closed eyduh closed 2 years ago

eyduh commented 3 years ago

Hiya, not sure if this is a bug or something I've done wrong.

I've tried this both with the old git and this one and get the same error (browser console):

This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”. taiga:9000
Your conf.json file is not a valid json file, please review it. app-loader.js:1:1451
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/v1/projects?discover_mode=true&order_by=-total_activity_last_year. (Reason: CORS request did not succeed).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/v1/stats/discover. (Reason: CORS request did not succeed).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/v1/projects?discover_mode=true&order_by=-total_activity_last_year. (Reason: CORS request did not succeed).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/v1/projects?discover_mode=true&order_by=-total_fans_last_year. (Reason: CORS request did not succeed).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/v1/projects?discover_mode=true&is_featured=true. (Reason: CORS request did not succeed).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/v1/stats/discover. (Reason: CORS request did not succeed).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/v1/projects?discover_mode=true&order_by=-total_fans_last_year. (Reason: CORS request did not succeed).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/v1/projects?discover_mode=true&is_featured=true. (Reason: CORS request did not succeed).

I don't see any errors in the logs after doing docker-compose up -d or ./launch-taiga.sh / ./launch-all.sh (I had an issue originally with not being able to create superuser but solved it with populating the database using python manage.py loaddata initial_user )

in journalctl I see some messages about sending mail, so probably not related:

[2021-05-16 10:16:29,589: INFO/MainProcess] Received task: taiga.projects.notifications.tasks.send_bulk_email
[2021-05-16 10:16:29,583: INFO/Beat] Scheduler: Sending due task send-bulk-emails

in my docker-compose files I have only changed the passwords, site from which to serve to the hostname of the server instead of "localhost:9000" as well as adding PUBLIC_REGISTER_ENABLED: "True" to the end of &default-back-environment and taiga-front

I have nginx-proxy-manager setup and forward to the hostname on port 9000, using this in the advanced tab:

location / {
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect off;
    proxy_pass http://the-hostname:9000/;
  }

I use nginx-proxy-manager for SSL termination which might cause some troubles but I had this working a few days ago with the old taigaio/taiga-docker. However, I get the same error whether connecting directly to http://the-hostname:9000 on the local network or https://the.public.url

The only difference in the compose files is that I added the public_register enabled env var and the penpot related stuff was pulled.

I didnt do anything with the Advanced config so not sure why it is complaining about an invalid json file. edit: I copied the file referenced the advanced config and mapped it to the suggested location and still get teh same error re: invalid json file

Your conf.json file is not a valid json file, please review it.
<anonymous> app-loader.js:1
    jQuery 4
        i
        fireWith
        _
        o
    v elements.js:9
    value elements.js:9
    value elements.js:9
    value elements.js:9
    o elements.js:9
    m elements.js:9
eyduh commented 3 years ago

Hmm.. I connected to the gateway to have a look at the nginx.conf and conf.d/* files and they seem to be in order. Looking up CORS errors it seems I need to add some variable to the nginx.conf of the stack itself. I'll keep looking into this.

edit: According to mozilla https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSDidNotSucceed "As of Firefox 68, https pages are not permitted to access http://localhost, although this may be changed by Bug 1488740." So I thought it might've been a firefox issue, however, I also get the error in ungoogled-chromium, but there it doesnt reference CORS but just say

Your conf.json file is not a valid json file, please review it.
GET http://localhost:8000/api/v1/stats/discover net::ERR_CONNECTION_REFUSED
GET http://localhost:8000/api/v1/projects?discover_mode=true&is_featured=true net::ERR_CONNECTION_REFUSED
GET http://localhost:8000/api/v1/projects?discover_mode=true&order_by=-total_fans_last_year net::ERR_CONNECTION_REFUSED
GET http://localhost:8000/api/v1/projects?discover_mode=true&order_by=-total_activity_last_year net::ERR_CONNECTION_REFUSED

Thinking this might have something to do with the invalid json file.. I also tried swapping it out for the example ones in /usr/share/nginx/html and restarting the taiga-front container but didnt seem to make a difference.

Am I missing something obvious?

diggymo commented 3 years ago

@eyduh

Hey! I was also in same situation. In my situation, the conf.json was actually invalid (You should also check conf.json once).

So when I rewrote it, it worked.

20

Xaviju commented 3 years ago

Hi @eyduh did you check your conf.json as @diggymo suggested?

Xaviju commented 2 years ago

Closing this since it had no response