On validating user input into my api, I want to return 400 http status codes for bad requests. It works fine from flask and when running my api through gunicorn, but they always come out of nginx as 500 errors. my site config is the following:
server {
listen 80;
server_name *****;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
proxy_pass http://localhost:8000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
any ideas on solutions would be very appreciated. Thanks.