413 error message

I’m receiving the below listed error when I try to add or modify columns in reports and when trying to enable a module, such as Tasks. It may produce this error other times, but these are the only things I’ve found so far. I was running v5.10.4 and updated to v5.10.24 thinking it may have been an update issue, but the error still persists. I assume this may be related to some nginx settings?? Also, this issue persists across multiple apps. I have tried on iPadOS, Windows app and it appears to not work on web also. Web only states “something went wrong.”

Your help is appreciated.

Error: please check that Invoice Ninja v5 is installed on the server

URL: http://192.168.1.29/api/v1/company_users/VolejRejNm?

Response: <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>


Headers: {connection: close, content-type: text/html; charset=utf-8, date: Mon, 19 Aug 2024 16:57:11 GMT, content-length: 192, server: nginx/1.18.0 (Ubuntu)}} ```

Hi,

It may help to disable mod_security

@hillel forgive me, where is that located?

That’s only necessary if they are using Apache2.

This would indicate they are using nginx.

Edit: They also state they are using nginx.

1 Like

@lukeh182 Can you please share your nginx config with personal information redacted?

@northhill please see below, and thank you. FYI I am using NPM as a reverse proxy and it contains my SSL cert.

 server {
# NOTE That the 'default_server' option is only necessary if this is your primary domain application.
# If you run multiple subdomains from the same host already, remove the 'default_server' option.
    listen       80;
#   listen       [::]:443 ssl http2 default_server;
    server_name  my.domain.com;
#   client_max_body_size 20M;

 # This if statement will forcefully redirect any connection attempts to explicitly use the domain name.
 # If not, and your DNS doesn't provide IP address protection, accessing the server with direct IP can
 # cause glitches with the services provided by the app, that could be security, or usability issues.

#   if ($host != $server_name) {
#     return 301 https://$server_name$request_uri;
#   }

 # Here, enter the path to your invoiceninja directory, in the public dir.  VERY IMPORTANT
 # DO NOT point the root directly at your invoiceninja directory, it MUST point at the public folder
 # This is for security reasons.
   root         /usr/share/nginx/invoiceninja/public;

   gzip on;
   gzip_types application/javascript application/x-javascript text/javascript text/plain application/xml application/json;
   gzip_proxied    no-cache no-store private expired auth;
   gzip_min_length 1000;

   index index.php index.html index.htm;

 # Enter the path to your existing ssl certificate file, and certificate private key file
 # If you don’t have one yet, you can configure one with openssl in the next step.
 # c ssl_certificate "/etc/nginx/cert/ninja.crt";
 # ssl_certificate_key "/etc/nginx/cert/ninja.key";

 # ssl_session_cache shared:SSL:1m;
 # ssl_session_timeout  10m;
 # ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL';
 # ssl_prefer_server_ciphers on;
 # ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

   charset utf-8;

 # Load configuration files for the default server block.
   include /etc/nginx/default.d/*.conf;

   location / {
       try_files $uri $uri/ /index.php?$query_string;
   }

   if (!-e $request_filename) {
           rewrite ^(.+)$ /index.php?q= last;
   }

   location ~ \.php$ {
           fastcgi_split_path_info ^(.+\.php)(/.+)$;
      # Here we pass php requests to the php7.4-fpm listen socket.
      # PHP errors are often because this value is not correct.
      # Verify your php7.4-fpm.sock socket file exists at the below directory
      # and that the php7.4-fpm service is running.
           fastcgi_pass unix:/run/php/php8.2-fpm.sock;
           fastcgi_index index.php;
           include fastcgi_params;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           fastcgi_intercept_errors off;
           fastcgi_buffer_size 16k;
           fastcgi_buffers 4 16k;
   }

   location ~ /\.ht {
       deny all;
   }

   location ~* \.pdf$ {
       add_header Cache-Control no-store;
   }

   location = /favicon.ico { access_log off; log_not_found off; }
   location = /robots.txt { access_log off; log_not_found off; }

   access_log /var/log/nginx/ininja.access.log;
   error_log /var/log/nginx/ininja.error.log;

   sendfile off;

  }

#  server {
#      listen      80;
#      server_name my.domain.com;
  #   add_header Strict-Transport-Security max-age=2592000;
  #   rewrite ^ https://$server_name$request_uri? permanent;
#  }

Do I need to enable client_max_body_size?

EDIT: The answer is yes. I enabled client_max_body_size 100M reloaded nginx and all is working as it should. Not sure what the approproate value should be, but I can say that 100M works. Hope this helps someone else.

2 Likes

I have mine set at 50M.

Excellent job on figuring it out.

1 Like