Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

3
CORS Issue
Post Body

Hey guys, so i've been stuck on this problem for awhile now... cant seem to find a problem.

I created api server using nginx and python flask and another server on different ip address is running a web server crated with react.

I got to a point I have added cors stuff to my nginx. so when I

curl -v my.domain.com/some/endpoint
< Server: nginx/1.14.0 (Ubuntu)
< Date: Fri, 20 Mar 2020 04:51:42 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 178
< Connection: keep-alive
< Allow: POST, OPTIONS
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Content-Type,Authorization
< Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
< Access-Control-Allow-Credentials: true

I get this result... But when i try to POST something on to the server i still seem to get cors error... have i done something wrong?

This is my /etc/nginx/sites-available/site location codes

location / {
    # include /etc/nginx/cors-settings.conf;
    include uwsgi_params;
    uwsgi_pass unix:///root/io-backend/main.sock;

    add_header "Access-Control-Allow-Origin" *;
    add_header "Access-Control_Allow-Methods" "GET, POST, OPTIONS";

    # Preflighted requests
    if ($request_method = OPTIONS ) {
        add_header "Access-Control-Allow-Origin"  *;
        add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
        add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
        return 200;
}

I cant seem to get a grasp whether this is still nginx problem or my python code problem... I do have Flask-CORS enabled on my backend tho.

Any help would be greatly appreciated... been stuck on this for a while now

Author
Account Strength
80%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
56
Link Karma
13
Comment Karma
31
Profile updated: 1 day ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago