Answer the question
In order to leave comments, you need to log in
Why in Nginx the limit_rate parameter may not work for http requests?
Good afternoon.
I limited the speed for the /uploads/ folder by adding a parameter to the Nginx config limit_rate 350k;
When uploading a file using the https protocol https://mysite.ru/download.php?file=some_file.zip
, the restriction works correctly, everything is fine, but if you try to upload via http, that is http://mysite.ru/download.php?file=some_file.zip
, there is no restriction anymore and the file is downloaded at maximum speed.
Please advise why this is happening and how it can be fixed?
nginx config
server {
listen 55.55.55.55:80;
server_name mysite.ru www.mysite.ru;
error_log /var/log/httpd/domains/mysite.ru.error.log error;
location / {
proxy_pass http://55.55.55.55:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/mysite.ru/public_html;
access_log /var/log/httpd/domains/mysite.ru.log combined;
access_log /var/log/httpd/domains/mysite.ru.bytes bytes;
expires max;
try_files $uri @fallback;
}
location /uploads/ {
internal;
limit_rate 350k;
root /home/admin/web/mysite.ru/public_html;
add_header Access-Control-Allow-Origin $upstream_http_Access_Control_Allow_Origin;
}
}
location /error/ {
alias /home/admin/web/mysite.ru/document_errors/;
}
location @fallback {
proxy_pass http://55.55.55.55:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.mysite.ru.conf*;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question