-
Notifications
You must be signed in to change notification settings - Fork 4
Image proxy
RSS Funnel provides an image proxy feature to circumvent limitations set by some websites that restrict image loading. This feature is implemented as a filter that can rewrite image URLs in your feeds.
The image proxy is configured and used through the image_proxy
filter in your RSS Funnel configuration. In most cases, no configuration is needed, and you can use the built-in proxy right away.
To use the image proxy with default settings, simply add it to your filters:
filters:
- image_proxy: {} # Use default settings
While the default settings work for most cases, you can customize the behavior if needed.
You can use either the built-in proxy or an external proxy service.
The built-in proxy is ready to use without any additional configuration. However, you can customize its behavior if needed:
filters:
- image_proxy:
proxy: socks5://localhost:9150 # Optional
referer: image_url_domain
user_agent: "Custom User Agent String"
-
proxy
(optional): Specify a proxy for the image request -
referer
(optional, default:image_url
): Thereferer
header for the image request- Options:
none
,image_url
,image_url_domain
, or a custom string
- Options:
-
user_agent
(optional, default:transparent
): Theuser-agent
header for the image request- Options:
none
,transparent
, or a custom string
- Options:
If you prefer to use an external proxy service:
filters:
- image_proxy:
external:
base: "https://external-proxy.example.com/proxy?url="
urlencode: true
-
base
: The base URL of the external proxy service -
urlencode
(optional): Whether to URL-encode the image URLs before appending them to the base. The default value depends on thebase
URL:- If the
base
URL ends with "=", the default istrue
- Otherwise, the default is
false
- If the
This default behavior is designed to work with common external proxy services:
- Some services expect the URL to be the last parameter, like
https://proxy.example.com/?url=
, where URL encoding is typically needed. - Others might expect the URL to be appended directly, like
https://proxy.example.com/
, where encoding might interfere with their parsing.
By analyzing the base
URL, the system tries to guess the appropriate default. You can always override this by explicitly setting urlencode
to true
or false
.
You can specify which images the proxy should be applied to. This works for both built-in and external proxies:
filters:
- image_proxy:
domains:
- "*.example.com"
- "images.somesite.net"
selector: "img.proxy-me"
-
domains
(optional): A list of domains to which the proxy should be applied (supports globbing) -
selector
(optional, default: "img"): A CSS selector to match the<img>
tags for URL rewriting
filters:
- image_proxy:
referer: image_url_domain
user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
domains:
- "*.example.com"
selector: "img.proxy-me"
filters:
- image_proxy:
external:
base: "https://images.weserv.nl/?url="
urlencode: true
domains:
- "*.exampleimages.com"
This section describes how the image proxy filter works. It's not necessary to understand these details for basic usage.
- The filter examines the HTML content of your feeds.
- It uses the provided CSS selector (default: "img") and domain list (if specified) to determine which image URLs to rewrite.
- For matching images, it rewrites the
src
attribute to point to the proxy URL (either the built-in proxy endpoint or the external proxy URL). - When a user's RSS reader tries to load the image, the request goes through the proxy.
- For the built-in proxy:
- The proxy endpoint validates the request using a signing key for security.
- It then fetches the original image using the specified parameters (referer, user-agent, etc.).
- The image is served to the user's RSS reader.
This process allows images to be loaded through the proxy, potentially bypassing restrictions set by the original image host.
The built-in proxy uses a signing key to prevent abuse and ensure that only requests generated by your RSS Funnel instance are processed. By default, this key is randomly generated each time the application starts. However, if you need the proxy URLs to remain valid across restarts, you can set a persistent signing key:
- Set the environment variable
RSS_FUNNEL_IMAGE_PROXY_SIGN_KEY
to a fixed string before launching the app. - This ensures that the same signing key is used across restarts, making the proxy URLs reusable.
For example:
export RSS_FUNNEL_IMAGE_PROXY_SIGN_KEY="your-secret-key-here"
./rss-funnel
Remember to keep this key secret, as it's used to validate proxy requests.