[Python] Nginx responds to http 'patch' requests with 400 bad request error

Discussão em 'Python' iniciado por Stack, Junho 5, 2025.

  1. Stack

    Stack Membro Participativo

    I work on a Django project + django-rest-framework. On localhost, PATCH requests work perfectly fine. However, on server, PATCH requests do not work. I get a 400 Bad request error. I use nginx to configure the web server.

    Here is my configuration:

    server {
    listen 80;
    server_name x.y.z.com;
    root /var/www/path-to/project;

    location / {
    error_page 404 = 404;
    proxy_pass http://127.0.0.1:5555/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_intercept_errors on;
    }
    }


    I get this error when I try PATCH requests on server :

    [​IMG]

    How can I make so that django accept PATCH requests? The log does not show anything. As if it does not even receives the request. I run the django server like this:

    python manage.py runserver 5555

    Continue reading...

Compartilhe esta Página