Preflight response is not successful. Status code: 502

Hey
I am trying to connect my angular app via tryton json-rpc. but I am not able to connect due to this
Preflight response is not successful. Status code: 502 I am pretty sure it might be due cors setting in tryton server . can some one please point me in right direction . my angular app is on localhost while tryton is running on different server using nginx

Update

I change browser from safari to chrome and this is the error I got in console

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

what would be the appropriate config for cors ?

This you set up the cors allowed hosts on your configuration file?

That’s how my config file looks

[web]

listen=0.0.0.0:8000

root=/var/lib/trytond/www

cors = *

You must set in cors a list of origins. So they must look like:

cors = 
    http://example.com
    https://example.com

so if my angular web app is running on localhost:4200
will this work

cors =
        http://localhost:4200

Thanks a lot this worked out for me

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.