CORS Issue

239 views
Skip to first unread message

Snap

unread,
Sep 22, 2015, 11:30:56 PM9/22/15
to taigaio
I have managed to get Taiga.io installed on an Ubuntu server, yet I have run into one major issue that I cannot overcome - CORS.

If I VNC into my server and open up a browser and surf to localhost:81 (where I have nginx serving pages), the login page works and I am able to login with no issues and see the sample data.  If I use a browser from my desktop and surf to the server's IP:81, I see the login screen perfectly.  As soon as I enter the login credentials, I get an Ooops screen, and the following error in my browser console: 11:16:45.818 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/v1/auth. (Reason: CORS request failed).1 <unknown>

What am I doing wrong that prevents this from loading on my desktop?

Thanks!

-snap-

Here are the files that I think will help:

conf.json

{
    "api": "http://localhost:8000/api/v1/",
    "eventsUrl": "ws://10.0.30.60:81/events",
    "debug": true,
    "publicRegisterEnabled": true,
    "feedbackEnabled": true,
    "privacyPolicyUrl": null,
    "termsOfServiceUrl": null,
    "maxUploadFileSize": null,
    "contribPlugins": []
}

nginx settings

server {
    listen 81 default_server;
    server_name _;

    large_client_header_buffers 4 32k;
    client_max_body_size 50M;
    charset utf-8;

    access_log /home/tccom/taiga/logs/nginx.access.log;
    error_log /home/tccom/taiga/logs/nginx.error.log;

    # Frontend
    location / {
        root /home/tccom/taiga/taiga-front-dist/dist/;
        try_files $uri $uri/ /index.html;
    }

    # Backend
    location /api {
        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_pass http://127.0.0.1:8001/api;
        proxy_redirect off;
    }

    # Django admin access (/admin/)
    location /admin {
        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_pass http://127.0.0.1:8001$request_uri;
        proxy_redirect off;
    }

    # Static files
    location /static {
        alias /home/tccom/taiga/taiga-back/static;
    }

    # Media files
    location /media {
        alias /home/tccom/taiga/taiga-back/media;
    }
}

Alejandro Alonso

unread,
Sep 23, 2015, 2:04:49 AM9/23/15
to Snap, taigaio
Hello!,

Probably the problem is this line in your conf.json
From your browser you should check that url is working and is browseable. I think it should be something like: http://server'_IP:81/api/v1/ this way the requests from the web app should go to nginx and fit in the API location.

Regards!,

--

  
Alejandro Alonso Fernández  
CIO & Co-founder

www.kaleidos.net/FC8EAC/

sna...@gmail.com

unread,
Sep 23, 2015, 3:43:04 AM9/23/15
to taigaio, sna...@gmail.com
Alejandro - you were absolutely correct!  Thank you so much for your help.  The help given in this community has helped me get everything installed.  I am extremely grateful!

-snap-

Alejandro Alonso

unread,
Sep 23, 2015, 3:45:41 AM9/23/15
to Samir Mowla, taigaio
You are welcome snap!

If you need anything more we will be happy trying to help you! ;)
Reply all
Reply to author
Forward
0 new messages