GET is working but POST is not working on Docker

The application is on Django configured with Docker. GET requests are working fine. But the POST requests are not working. I am adding the nginx.conf file below for the reference.

The POST request is necessary for authentication.

upstream app_server {
  server djangoapp:8000 fail_timeout=0;
}

server {
  listen 80;
  server_name samplewebsite.com;
  root /opt/djangoapp/src/samplewebsite/samplewebsite;
  index index.html;

  server_tokens off;

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

  location /media  {
    alias /opt/djangoapp/src/media/;
  }

  location /static {
    alias /opt/djangoapp/src/static/;
  }

  location /api/ {
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_pass http://app_server/;
  }

  location /admin/ {
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_pass http://app_server/admin/;
  }

    client_max_body_size 128m;
}


The response of the POST request is Error code 405.

Let me know if I need to add more information to the question.

Source: Docker Questions