this post was submitted on 30 May 2026
8 points (100.0% liked)
Lemmy Today
328 readers
1 users here now
If you experience issues or problems with this instance (lemmy.today), this is the place to discuss them. Or if you just want to ask questions about how something works. Anything related to the instance or lemmy itself.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Hello! I'm the person who made that fork.
If it does get set up here and you have any questions or run into any issues (which could very well happen, as I've done some major refactors), feel free to contact me, either by email at
mlmym@lists.mschae23.deor in the#mlmym:mschae23.dematrix room.You can also try it out already at discuss.mschae23.de (only logged-out here, of course, which doesn't give you all options) or by running it up locally with
LEMMY_DOMAINset tolemmy.today.I'd also recommend enabling some of the options instance-wide by default, especially
SHOW_UNREAD_COMMENTS(this one has been really useful for me).I wanted to ask you also if you could forward certain http headers to lemmy when it makes a request? Currently it doesnt forward them so lemmy thinks all the requests from mlmym to lemmy are from the docker ip its running on. And that makes it much harder to rate limit or ban bots since all requests are from the docker ip.
So basically, mlmym should preserve and forward
X-Real-IP,X-Forwarded-For,X-Forwarded-Proto, andX-Forwarded-Hostwhen proxying API/backend requests to Lemmy, because Lemmy uses these headers for correct client IP detection and rate limiting.Something like this in the code where the incoming request is handled:
That would really help a lot and allow me and others to remove a lot of complicated workarounds for trying to get the source ip.
I have some handling for
X-Forwarded-For, but none of the others. This could actually explain why I was still seeing rate limit errors despite not having made many requests from my IP address.I'm unfortunately busy this week, but I hope I can still find some time in the next few days to implement this.
Shouldn't that fallback be
http, since mlmym doesn't do HTTPS itself? And I assume the reverse proxy will have setX-Forwarded-Prototohttps.Yeah, I have a custom setup currently just to try and get the source ip, but it doesn't work properly in all cases. And most of the bots use old.lemmy.today since they know mlmym doesn't forward the source ip address, and therefore it's hard to rate limit them.
So it would be amazing if you could forward those 4 headers. Then I will setup nginx to forward those headers to mlmym, and mlmym will forward them when making a request to Lemmy.
I actually thought it was making a https connection to Lemmy but perhaps it doesn't, and nginx just forwards http to https. Not sure. Will have to look into this more.
But yeah, whenever you have time to add the headers, i will investigate more. Not super urgent but will be interesting to play with that later. And it will protect all Lemmy instances that use your fork, so thats good.
If you configure it to set
X-Forwarded-For, you should have at least that information now already.That depends on the setup. If you haven't already, you should definitely set
LEMMY_INTERNAL_URLso that mlmym connects to lemmy directly without TLS or a reverse proxy, which should be a lot faster (but that's only possible if they're running on the same machine, of course).X-Forwarded-Protois supposed to say what protocol the user (of mlmym) originally connected with though, right? Which will still end up beinghttpsin the common case of it being behind a reverse proxy that does TLS.I will experiment more with this tomorrow or the coming days then. I was trying to get it to work previously but failed (not using your fork but the original mlmym).
I ended up using the external nginx for setting rules for rate limiting and such, and there I see the real ip. It's before traffic even gets to mlmym so that's good.
Also made sure to make it use the internal Lemmy url and skip a lot of the proxy stuff I was using earlier. It seems faster now.
I implemented the headers today, so version 26.2.1 should hopefully do this correctly now.
I could only really test it in my deployment, so feel free to let me know if you have any issues!
It works! I discovered way too late that lemmy was rate limiting traffic from mlmym, because it wasnt part of my nginx config. It was lemmy itself that was doing rate limiting since all requests came from the same docker ip.
But forwarding the real ip headers fixed that, so very good. Huge thanks!
Cool. :) I think that will be a very useful feature for a lot of Lemmy admins.
Will play around with it later...!
Thank you for your work on this. We are running it now on this instance. :)