Skip to content

[xExtension-ImageProxy] Add a list of domains that are not proxied - #577

Merged
Frenzie merged 7 commits into
FreshRSS:mainfrom
NopeCharon:imageproxy-excluded-domains
Nov 12, 2026
Merged

Frenzie merged 7 commits into
FreshRSS:mainfrom
NopeCharon:imageproxy-excluded-domains

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

Summary

Adds the domain list requested in #229: images from these hosts are not sent through the proxy. This helps when:

  • images come from internal hosts that the proxy cannot reach (an intranet, a private IP range, or a self-hosted wsrv.nl that refuses private addresses)
  • the proxy refuses some domains, like the ones blocked by wsrv.nl (for example i0.wp.com)

How it works:

  • the configuration page has a new Do not proxy these domains textarea. Put one domain per line, or separate them with commas. It is empty by default, so nothing changes until a user fills it in
  • when an image URL's host matches an entry or one of its subdomains, the URL is left as it is. This applies to src, to each srcset candidate and to video posters. Matching is case-insensitive and only checks the host, so ports and paths are ignored. *.example.org, .example.org and IPv6 addresses with or without brackets are accepted too. A host that only happens to end with the same text (myexample.org) is still proxied
  • I followed the approach suggested in [ImageProxy] Domain whitelist #229 (comment), but also accept newlines and match subdomains, so that a single entry covers CDNs like *.wp.com
  • includes regression tests, a README entry with a changelog line, and en/de/fr/nl translations. The Turkish strings are marked // TODO. The version goes to 1.1.0

Fixes #229

Validation

  • composer run-script test-image-proxy: the new tests fail on main (Excluded domains must not be proxied) and pass with the change (40 assertions), on PHP 8.1 and 8.5
  • end to end against FreshRSS edge with a SQLite user, through the FreshRSS CLI bootstrap:
    • init() stores an empty default
    • handleConfigureAction() saves the posted textarea
    • configure.phtml renders the saved value HTML-escaped
    • the entry_before_display hook leaves https://a.intranet.example/… and http://10.0.0.5/… alone but still proxies https://other.example/…
  • composer run-script php-lint, phtml-lint, phpcs, phpstan (with ../FreshRSS), plus markdownlint-cli2 and stylelint

Every image whose scheme is enabled for proxying was sent through the
proxy, with no way to keep some hosts out. This breaks images served
from internal hosts that the proxy cannot reach (e.g. an intranet or a
private IP range, which also happens with a self-hosted wsrv.nl), and
images from domains that the proxy refuses to serve, such as some of the
domains blocked by wsrv.nl.

Add an "excluded domains" setting to the configuration page: a textarea
taking one domain per line or a comma-separated list, empty by default.
When the host of an image URL (`src`, each `srcset` candidate, or video
`poster`) is one of those domains or a subdomain of one of them, the URL
is left untouched. The comparison is case-insensitive and only looks at
the host, so ports and paths do not matter. Entries written as
`*.example.org` or `.example.org` are accepted, as are IPv6 addresses
with or without brackets. Hosts that merely end with an excluded domain
(`myexample.org`) are still proxied.

Add regression tests, document the setting in the README with a
changelog entry, add the English, German, French and Dutch translations
(Turkish is marked as TODO), and bump the extension version to 1.1.0.

Fixes FreshRSS#229
@Frenzie

Frenzie commented Nov 11, 2026

Copy link
Copy Markdown
Member

To clarify, do you speak Dutch? Either way I don't wish to see that workaround; I'd rather remove that dumb program if it causes issues.

…ead of rewording

Restore the original Dutch help text and skip the nl i18n folder in typos, like the other non-English translations.
@NopeCharon

Copy link
Copy Markdown
Contributor Author

No, I don't speak Dutch, so the nl strings are a best effort and a native speaker should check them. The workaround is gone: the original wording is back and i18n/nl is now excluded from typos like the other translations (5f1285e).

@Frenzie

Frenzie commented Nov 11, 2026

Copy link
Copy Markdown
Member

I was a bit too distracted by the second commit doing something weird, but there's no need for commas, is there? Domain names can't contain spaces.

Domain names cannot contain whitespace, so newlines and spaces are
enough to separate entries and commas are not needed.
@NopeCharon

Copy link
Copy Markdown
Contributor Author

Right, whitespace is enough. Commas are gone from the parsing, the help texts, the README and the test: 923477a

@Alkarex
Alkarex requested a review from Frenzie November 11, 2026 20:04
Comment thread xExtension-ImageProxy/i18n/en/ext.php Outdated
'url_encode' => 'Encode the URL'
'url_encode' => 'Encode the URL',
'excluded_domains' => 'Do not proxy these domains',
'excluded_domains_help' => 'One domain per line. Their subdomains are not proxied either: for instance, example.org also matches images.example.org.',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'excluded_domains_help' => 'One domain per line. Their subdomains are not proxied either: for instance, example.org also matches images.example.org.',
'excluded_domains_help' => 'One domain per line. Subdomains are included as well: for instance, example.org also matches images.example.org.',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied, thanks. 67ed4b1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update the translations?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, de, fr and nl now use the same wording (tr stays English with the TODO): 1de0780

Comment thread xExtension-ImageProxy/extension.php Resolved
@Frenzie
Frenzie merged commit 00494fa into FreshRSS:main Nov 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ImageProxy] Domain whitelist

2 participants