A Flask-based proxy for FreshRSS that securely forwards API requests, eliminating the need to expose raw FreshRSS endpoints directly. Configurable via environment variables (or a .env
file).
FreshProxy acts as a dedicated HTTP proxy for your FreshRSS instance, enhancing security and simplifying request structures. By using a single proxy endpoint (/digest
), you avoid having to expose or directly query each feed or subscription list from the client.
- Single Aggregator Endpoint:
GET /digest
: Returns a globally-sorted list of recent feed items from your FreshRSS instance.- Optional query parameters:
label=<labelName>
: Filter feeds by label.n=<int>
: Number of items to fetch per feed (defaults to 1).page=<int> & limit=<int>
: For item-level pagination (defaults: page=1, limit=50).
- Optional query parameters:
- CORS restrictions, allowing only whitelisted origins.
- Timeout and error handling for upstream requests.
- Environment-based configuration (via
.env
or standard env vars). - Docker Support for easy deployment.
- Clone the repository:
git clone https://github.com/hstct/FreshProxy.git
cd FreshProxy
- Install dependencies (pick one approach):
- Using pip
requirements.txt
:
pip install -r requirements.txt
- Using pip with
pyproject.toml
:
pip install . # or for dev/test extras pip install .[test,lint]
- Using pip
- Create a
.env
file:
cp .env.example .env
- Edit the
.env
file with your configurations:
FRESHRSS_API_TOKEN=your-secret-token
FRESHRSS_BASE_URL=https://freshrss.example.com/api/greader.php/reader/api/0
FRESHPROXY_ALLOWED_ORIGINS=http://localhost:3000,https://mydomain.com
FRESHPROXY_HOST=0.0.0.0
FRESHPROXY_PORT=8000
FRESHPROXY_DEBUG=False
FRESHPROXY_REQUEST_TIMEOUT=10
FRESHRSS_API_TOKEN
: Secret token used to authenticate with your FreshRSS instance.FRESHRSS_BASE_URL
: Root URL of your FreshRSS GReader API (no trailing slash).FRESHPROXY_ALLOWED_ORIGINS
: Comma-separated list of origins for CORS.FRESHPROXY_HOST
: The Flask host. (Default:0.0.0.0
)FRESHPROXY_PORT
: The Flask port. (Default:8000
)FRESHPROXY_DEBUG
: Enable debug mode. (Default:False
)FRESHPROXY_REQUEST_TIMEOUT
: Timeout for proxied requests in seconds. (Default:10
)
- Ensure
.env
is configured with your secrets and config. - Run the application:
python run.py
- Check the endpoint:
curl "https://localhost:8000/subscriptions"
or open in your browser.
Gunicorn is recommended for the application in production:
gunicorn --bind 0.0.0.0:8000 freshproxy.app:create_app --worker-class sync --workers 4
A Dockerfile is included for container-based deployment:
- Build the Docker image:
docker build -t freshproxy .
- Run the container:
docker run -p 8000:8000 \
-e FRESHRSS_API_TOKEN="my-secret-token" \
-e FRESHRSS_BASE_URL="https://freshrss.example.com/api/greader.php/reader/api/0" \
-e FRESHPROXY_ALLOWED_ORIGINS="http://localhost:3000,https://mydomain.com" \
-e FRESHPROXY_HOST="0.0.0.0" \
-e FRESHPROXY_PORT=8000 \
-e FRESHPROXY_DEBUG=False \
-e FRESHPROXY_REQUEST_TIMEOUT=10 \
freshproxy
- Test:
curl "http://localhost:8000/subscriptions"
Contributions via pull requests or suggestions in issues are welcome! Please open an issue for discussion first if it's a major change. When contributing:
- Fork & clone the repository locally.
- Create new feature/bug branch:
git checkout -b feature/my-feature
. - Make changes, add tests if relevant.
- Lint & format your code:
black .
flake8 .
- Commit & push your branch, then open a pull request.