Skip to content

Instantly share code, notes, and snippets.

@kovyrin
Created December 7, 2008 05:17
Show Gist options
  • Save kovyrin/33034 to your computer and use it in GitHub Desktop.
Save kovyrin/33034 to your computer and use it in GitHub Desktop.
location ~ ^/upload/(bulk_1|java_bulk_1|single|rev_upload)$ {
error_log logs/upload.scribd.error.log info;
access_log logs/upload.scribd.access.log main;
set $upload_uri $uri?$args;
if ($request_method = GET) {
rewrite .* /internal_upload last;
}
# Pass altered request body to this location
upload_pass /internal_upload;
upload_pass_args on;
# Store files to this directory
# The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
upload_store /scribd_upload/queue 1;
# Allow uploaded files to be read only by user
upload_store_access all:rw;
# 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";
upload_set_form_field $upload_field_name.host "web01.local";
upload_pass_form_field "";
# 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_cleanup 400 404 499 500-505;
}
location /internal_upload {
internal;
error_log logs/upload.scribd.error.log info;
access_log logs/upload.scribd.access.log main;
proxy_pass http://www_haproxy_slurp$upload_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment