AnswerBun.com

NGINX gives 502 error from browsers but not from Postman

Stack Overflow Asked by knguyen on October 13, 2020

I’ve got a Django application running on Azure App Service using NGINX.

My nginx.conf file is as follow:

user  nginx;
worker_processes 1;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
    worker_connections 1024;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
    fastcgi_max_temp_file_size 0;
    fastcgi_buffers 128 2048k;
    fastcgi_buffer_size 2048k;
    proxy_buffer_size   128k;
    proxy_buffers   4 256k;
    proxy_busy_buffers_size   256k;
    server {
        listen 8000;
        location / {
            include uwsgi_params;
            uwsgi_pass unix:///tmp/uwsgi.sock;
        }
        location /static {
            alias /app/staticfiles;
        }
    }
}

daemon off;

Everything works fine, except for one particular API where I include in the header some token (typical bearer token) and it’s returning a 502 error from Chrome (in the network tab)

However, when I try to call this from Postman, it’s returning the data correctly.

What could be possibly wrong here?

One Answer

Thanks to @Selcuk's suggestion. I've managed to fix the above error by increasing the buffer-size in iwsgi.ini file

# uwsgi.ini file

buffer-size = 32768

Answered by knguyen on October 13, 2020

Add your own answers!

Related Questions

Invalid shorthand property initializer

5  Asked on December 27, 2021 by pallab-ganguly

   

Drupal payment method getting access denied for admin

1  Asked on December 27, 2021 by vijayanand-premnath

   

How can I plot more 10k points using matplotlib?

1  Asked on December 27, 2021 by andkot

     

PHP; time conversion form distance and speed

2  Asked on December 27, 2021 by nway

   

Jest test with SpyOn

1  Asked on December 27, 2021 by user9855821

 

json.Decoding a TCP connection and logging the original data at the same time in Go

2  Asked on December 27, 2021 by mnv3akndilyweipfg0ocvwiuob

         

Check lists are equal whilst accounting for nulls

1  Asked on December 27, 2021

       

Not sure how to change the behavior of my CSS Grid

1  Asked on December 27, 2021 by m3hran

     

Fluentd how to get source from a file by executing a script

1  Asked on December 27, 2021 by snoogybunny

 

Var keyword in Java

5  Asked on December 27, 2021 by harold-ibouanga

   

shorten the string to the desired values

3  Asked on December 27, 2021

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir