LemmyNet / lemmy

🐀 A link aggregator and forum for the fediverse
https://join-lemmy.org
GNU Affero General Public License v3.0
12.95k stars 859 forks source link

Allow bypassing proxy for some domains with ProxyAllImages #4874

Open sunaurus opened 1 week ago

sunaurus commented 1 week ago

This PR introduces a new settings parameter, proxy_bypass_domains, which allows admins to configure some domains for which image proxying will be skipped.

The skipping logic is within the image_proxy/ endpoint itself, so URLs do not have to change whenever the bypass list is modified by admins. If any domain is on this bypass list, then instead of trying to proxy the image through pict-rs, Lemmy will just issue a HTTP redirect to the source image.

There are a couple of reasons such configuration can be useful. For example, imgur will very quickly start blocking all requests from Lemmy when running with ProxyAllImages, due do its rate limits. Additionally, a few Lemmy instances provide their own external image hosting service, this setting will allow them to not duplicate the same images in two places.

Nutomic commented 3 days ago

I would consider bypassing some domains by default, such as imgur you mentioned. Because most admins wont know which ones can break. Though it should still be possible to remove the default values. If thats too complicated, its also good to list problematic domains somewhere in documentation.

dullbananas commented 2 days ago

There should be a change to how requests for proxying are done: