skip to Main Content

Where does the NGINX ingress controller stores temporary files?

This is the message I receive and I am pretty sure it is storing the file on a volume attached to one of my pods:

2021/09/27 20:33:23 [warn] 33#33: *26 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000002, client: 10.42.1.0, server: _, request: "POST /api/adm/os/image HTTP/1.1", host: "vzredfish.cic.shidevops.com", referrer: "https://vzredfish.cic.shidevops.com/setting"

But when I go into the location /var/cache/nginx/client_temp there is nothing.

I checked on the ingress controller pods too and there is another there either.

I would like to know how to troubleshoot the issue we have. I’m trying to upload a file directly to the pod memory but instead it uploads it to a temporary location first.

Thanks for the help.

Danilo

2

Answers


  1. Chosen as BEST ANSWER

    I want to thank Jakub Siemaszko for the pointer, that was partially the solution.

    Our app is deployed in a k8s cluster, we have an nginx controller and an nginx instance in one of the pods. The issue I was having was related to the nginx in the pod and not the controller (I was changing directives and keys in the controller)

    In the nginx inside of the pod i had to change the nginx.conf and add the following to both HTTP and location

    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;
    client_max_body_size 25000M;
    proxy_buffering off;
    proxy_ignore_client_abort on;
    proxy_read_timeout 3600;
    proxy_http_version 1.1;
    proxy_connect_timeout 3600;
    proxy_send_timeout 3600;
    fastcgi_send_timeout 3600;
    fastcgi_read_timeout 3600;
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;
    
    sendfile        off;
    #tcp_nopush     on;
    
    keepalive_timeout  65;
    
    #gzip  on;
    
    server {
        listen 80 default_server;
    
        server_name _;
    
        root /usr/share/nginx/html;
        index index.html;
    
    
        location /api {
            return 302 /api/;
        }
        location /api/ {
            proxy_pass http://backend:3000/;
        }
        location /downloads {
            autoindex on;
        }
        location / {
          try_files $uri $uri/ /index.html;
          proxy_read_timeout 3600;
          proxy_http_version 1.1;
          proxy_connect_timeout 3600;
          proxy_send_timeout 3600;
          fastcgi_send_timeout 3600;
          fastcgi_read_timeout 3600;
        }
    }
    
    include /etc/nginx/conf.d/*.conf;
    }
    

    This fixed the 504 errors (I still see 499 but it is able to complete the upload of the large files).

    As for the location of the temp file, that is still a mystery but it's something we don't need to monitor anymore


  2. Answering your question indirectly there seems to some ways to skip proxy buffering to achieve your goal of uploading a file directly to the pod memory, I’ve found an interesting article here, have a look at the Disable proxy buffering section.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search