Kirk
Kirk

Reputation: 1541

Why won't my upload_limit_rate for NGINX work?

I am doing some testing on my local machine using the nginx upload module with the upload progress module. Because I am local, uploads are almost instant and it's hard to test and debug the upload progress module because of this.

I have added the directive: upload_limit_rate 8k to my nginx upload block as per the documentation: http://www.grid.net.ru/nginx/upload.en.html

After all this, uploading a file that is many megabytes is still instant... it seems the upload rate limit is not working..

Here is my config block:

FULL CONFIG can be found here: http://pastie.org/4681229


location /upload {

# Pass altered request body to this location
    upload_pass   @unicorn;


    # Store files to this directory
    # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
    upload_store /Users/kirkquesnelle/Sites/porelo/tmp/uploads 1;

    # Allow uploaded files to be read only by user
    upload_store_access user:r;

    # Set specified fields in request body
    upload_set_form_field $upload_field_name.name "$upload_file_name";
    upload_set_form_field $upload_field_name.content_type "$upload_content_type";
    upload_set_form_field $upload_field_name.path "$upload_tmp_path";

    # Inform backend about hash and size of a file
    upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";
    upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";

    upload_pass_form_field "^X-Progress-ID|^authenticity_token|^submit$|^description$";

    upload_cleanup 400 404 499 500-505;

    # Specifies upload rate limit in bytes per second. Zero means rate is unlimited.
    upload_limit_rate 8k;

    track_uploads proxied 30s;

}


Is there anything wrong with my config? Why would this not work?

Thanks

Upvotes: 2

Views: 2635

Answers (1)

YAAK
YAAK

Reputation: 328

Try to set the upload_limit_rate before your upload_pass directive. As the first line in your config block.

Upvotes: 1

Related Questions