1

I am running multiple Virtual Machines (Proxmox) which each have limited storage amounts. As I am also running a File-Uploading service, I am interested if a Reverse Proxy needs more than 30GB of storage.

I have 1 reverse proxy which redirects to 3 webservers.

Would the storage (or the cache?) of the reverse proxy be used if someone uploads 50GB of data to the webservers?

2 Answers2

2

Yes. By default, nginx will cache the request body. So if you're uploading 50 GB across 5 servers then your reverse proxy will have to store all 50 GB. (assuming the uploads are going on at the same time)

You can disable this using the proxy_request_buffering directive. This has some implications on load-balancing, such as being unable to send request to the next server if the first one fails.

There are also specific requirements for the proxy connection so I suggest reading the documentation for the full details: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_request_buffering

Martin Fjordvald
  • 7,749
  • 1
  • 30
  • 35
0

Your post is moderately unclear. I don't think you're referring to nginx fastcgi caching, but you could be.

Nginx does what you tell it to do. If you're using proxy_pass then my understanding is it just passes the connection to the next server, it doesn't receive the upload then send it on itself. ie nginx acts like a connection proxy.

If you're talking about nginx fastcgi caching, then you just disable it. The following disables caching in two ways - for POSTs, and based on a set of rules. Use whichever bits you think suitable.

server {
  ...
  set $skip_cache 0;
  if ($request_method = POST) {
    set $skip_cache 1;
  }
  if ($query_string != "") {
    set $skip_cache 1;
  }
  # Don't cache uris containing the following segments.
  if ($request_uri ~* "/wp-admin/|/admin-*|/purge*|/xmlrpc.php|wp-.*.php|/feed/|sitemap(_index)?.xml") {
    set $skip_cache 1;
  }
  # Don't use the cache for logged in users or recent commenters
  if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|code") {
    set $skip_cache 1;
  }

  location ~ \.(hh|php)$ {
    fastcgi_cache CACHE_NAME;
    fastcgi_cache_valid 200 1440m;

    fastcgi_cache_methods GET HEAD;
    fastcgi_cache_bypass $skip_cache;
    fastcgi_no_cache $skip_cache;
  }
Tim
  • 31,888
  • 7
  • 52
  • 78
  • Thank you. I do use proxy_pass. And all I wanted to know is that the files don't get uploaded through the proxy server. –  Jan 20 '16 at 20:20
  • I would personally want to double check. Do "df -k" to check disk usage, upload a few GB files, then run "df -k" again to double check disk usage hasn't changed. – Tim Jan 20 '16 at 20:52