Comment on [PSA] Watch for the antiyanks troll and consider adjusting your rate limits
admiralpatrick@lemmy.world 2 days agonginx.org/en/docs/…/ngx_http_proxy_module.html
$proxy_add_x_forwarded_for
is a built-in variable that either adds to the existing X-Forwarded-For header, if present, or adds the XFF header with the value of the built-in $remote_ip
variable.
The former case would be when Nginx is behind another reverse proxy, and the latter case when Nginx is exposed directly to the client.
Assuming this Nginx is exposed directly to the clients, maybe try changing the bottom section like this to use the $remote_addr
value for the XFF header. The commented one is just to make rolling back easier. Nginx will need to be reloaded after making the change, naturally.
# Add IP forwarding headers proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $remote_addr;
Sal@mander.xyz 2 days ago
Thanks!
I was able to crash the instance for a few minutes, but I think I have a better idea of where the problem is. Ths $emote_addr variable seems to work just the same.
In the rate limit options there is a limit for ‘‘Message’’. Common sense tells me that this means ‘direct message’, but setting this to a low number is quite bad. While testing I eventually set it to ‘1 per minute’ and the instance became unresponsive until I modified the settings in the database manually. If I give a high number to this setting then I can adjust the other settings without problem.
admiralpatrick@lemmy.world 2 days ago
“Message” bucket is kind of a general purpose bucket that covers a lot of different endpoints. I had to ask the lemmy devs what they were back when I was adding a config section in Tesseract for the rate limits.
These may be a little out of date, but I believe they’re still largely correct:
Image
Sal@mander.xyz 2 days ago
So, ultimately my problem was that I was trying to set all of the limits to what I thought were “reasonable” values simultaneously, and misunderstood what ‘Message’ meant, and so I ended up breaking things with my changes without the reason being obvious to me. I looked into the source code and I can see now that indeed ‘Messages’ refer to API calls and not direct messages, and that there is no ‘Direct Message’ rate limit.
If I let ‘Messages’ stay high I can adjust the other values to reasonable values and everything works fine.
Thanks a lot for your help!! I am surprised and happy it actually worked out and I understand a little more 😁
BlueEther@lemmy.nz 2 days ago
Hi I think I set the messages too low as well and now no.lastname.nz is down, pointers on how to fix with no frontend?
admiralpatrick@lemmy.world 2 days ago
Awesome! Win-win.