Download Limit per IP per hour

Hello everyone,

Trying to accomplish something. I want to limit how many times an IP address can download a file per hour. I think we have the code to accomplish this, but We do not know where to add this code :sweat_smile:.

So my question is:
What php file handles downloads. e.g. download.php?

Any help would be appreciated!

Thank you so much in advance,
CesiumOS Admin

If you have a server overwhelmed issue, you can configure nginx :

But I don’t know if it is possible to limit the number of download…

That isn’t what I asked. I want to know what file handles downloads…

But since you brought this solution up, my issue is I want to limit 5 requests per ip address per hour. Nginx rate limiting only allows integers for seconds and minutes not hours.

And actually just tried it with the following code:
limit_req_zone $binary_remote_addr zone=download:10m rate=1r/m;

server {
location /download/ {
limit_req zone=download;
}
}

And it did not work.

So do you know what file handles downloads or not? Or any solution that meets my needs.

Anyone??? Still need help with this issue

What you’re asking for is not a normal function of Nextcloud. Being a solution for hosting and accessing your own data, bandwidth restrictions would generally be counterproductive.

I am asking a simple question. Do you know the answer to it or no?

1 Like

That’s kind of rude.

The mechanism can you analyse with Firefox/Chrome option F12 network-monitor.

The download (shared download is):
https://cloud.server.tld/index.php/s/<link-to-share???>/download

Perhaps you can better minimize bandwith with nginx or on the router.

How is it rude. I am asking a questions which you clearly didn’t answer sir.

Um really? At this point nextcloud forum is just spam. This has nothing to do with what I asked…

Really? I wrote this:
https://cloud.server.tld/index.php/s/<link-to-share???>/download

And with this http-request (find on client and server) you can calculate the MB and GB for each client/user. You can search the source code and modify it. Also you can perhaps set bandwith on the router between client and server.

It appears remote.php is the file you are looking for.
If you hover over a file you get:
https://f.q.d.n/remote.php/webdav/myfile.txt
At least that’s what I get for 17.0.0

@CesiumOS
This forum is not spam, this is community ran.

I found the solution for this but after reading your rude replies, i dont feel like sharing it without. Everyone report this @CesiumOS and whoever wants that solution please dm.