Repository navigation
[xExtension-ImageProxy] Add a list of domains that are not proxied - #577
Conversation
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
|
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.
|
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). |
|
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.
|
Right, whitespace is enough. Commas are gone from the parsing, the help texts, the README and the test: 923477a |
| '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.', |
There was a problem hiding this comment.
| '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.', |
There was a problem hiding this comment.
Can you also update the translations?
There was a problem hiding this comment.
Done, de, fr and nl now use the same wording (tr stays English with the TODO): 1de0780
Summary
Adds the domain list requested in #229: images from these hosts are not sent through the proxy. This helps when:
i0.wp.com)How it works:
src, to eachsrcsetcandidate and to videoposters. Matching is case-insensitive and only checks the host, so ports and paths are ignored.*.example.org,.example.organd 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*.wp.com// TODO. The version goes to 1.1.0Fixes #229
Validation
composer run-script test-image-proxy: the new tests fail onmain(Excluded domains must not be proxied) and pass with the change (40 assertions), on PHP 8.1 and 8.5edgewith a SQLite user, through the FreshRSS CLI bootstrap:init()stores an empty defaulthandleConfigureAction()saves the posted textareaconfigure.phtmlrenders the saved value HTML-escapedentry_before_displayhook leaveshttps://a.intranet.example/…andhttp://10.0.0.5/…alone but still proxieshttps://other.example/…composer run-script php-lint,phtml-lint,phpcs,phpstan(with../FreshRSS), plusmarkdownlint-cli2andstylelint