Introduction
This article aims to cover the strange networking issues encountered when setting up FreshRSS behind an Nginx reverse proxy on a Garnet machine. FreshRSS is an open-source RSS aggregator that allows users to read news from multiple sources in one place. Nginx is a popular open-source web server and reverse proxy server.
Prerequisites
Before we dive into the issue, let's make sure we have the following prerequisites in place:
- A physical machine running Garnet
- Docker installed on the Garnet machine
- FreshRSS Docker container running on the Garnet machine, exposed on port 8083
Browser Connection
The browser can connect to the FreshRSS service using the URL http://garnet.local:8083. The service works perfectly fine when accessed directly.
Nginx Reverse Proxy
To make the FreshRSS service accessible via a custom domain name, we decide to set up an Nginx reverse proxy. We create an Nginx configuration file:
server {
listen 80;
server_name rss.garnet.local;
location / {
proxy_pass http://garnet.local:8083;
proxy_http_version 1.1;
proxy_set_status on;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
We then reload the Nginx configuration.
Strange Networking Issues
After setting up the Nginx reverse proxy, we encounter strange networking issues. The browser can no longer connect to the FreshRSS service using the custom URL http://rss.garnet.local. Instead, we receive an error message:
Connection to rss.garnet.local refused
We investigate the issue by checking the Nginx access and error logs. We notice that the Nginx reverse proxy is receiving requests but unable to forward them to the FreshRSS container.
Solution
After some research, we discover that the issue is due to the FreshRSS container not being able to bind to the external interface of the Garnet machine. We need to modify the Docker compose file to bind the FreshRSS container to the external interface:
version: '3'
services:
freshrss:
image: freshrss/fresh:latest
ports:
- "8083:8080"
- "80:80"
networks:
- mynetwork
networks:
mynetwork:
We then rebuild and restart the FreshRSS container.
In this article, we covered the strange networking issues encountered when setting up FreshRSS behind an Nginx reverse proxy on a Garnet machine. We discovered that the FreshRSS container was not able to bind to the external interface of the Garnet machine, resulting in the Nginx reverse proxy being unable to forward requests to the container. We solved the issue by modifying the Docker compose file to bind the FreshRSS container to the external interface.