Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have sorted CORS issues in my application and now i still have one issue which is getting 502 error when uploading an image.

My nginx config for backend is

server {

    server_name api.backend;

    location / {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, X-Access-Token';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT';
        proxy_pass http://localhost:4000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

    }

}

And my nginx config for front end is

server {

    server_name www.frontend.com frontend.com;

    root /var/www/html;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;
     }

}

And this is the network tab of the request which i get 502 error

enter image description here

I tried adding these lines but no luck

proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;

What could be the reason for this issue and how can i fix it? Thanks in advance :)

question from:https://stackoverflow.com/questions/66067281/502-error-when-uploading-an-image-nginx

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
581 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...