Install Apache 2
sudo apt install apache2
Modify configuration file
sudo nano /etc/apache2/apache2.conf
Add these lines at the end
# Patching error AH00558
ServerName 127.0.0.1
Add modules
sudo a2enmod headers remoteip rewrite proxy proxy_fcgi
And restart Apache
sudo systemctl reload apache2
On the firewall / gateway
Temporarily Connected on baggins as mountdoom, edit Caddy configuration
sudo nano /etc/caddy/Caddyfile
Add this entry at the end of the file
pixelfed.cogip.be {
reverse_proxy 192.168.10.60 {
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-For {remote}
header_up X-Forwarded-Host {host}
}
}
And reload
sudo systemctl reload caddy
About the Caddy file
Inside the reverse_proxy block, three headers are added to the outgoing request (from Caddy to the backend server)
header_up X-Forwarded-Proto {scheme}
Adds the X-Forwarded-Proto header, which tells the backend whether the original request used http or https.
{scheme} is a placeholder for the request’s protocol (e.g., https if the user accessed https://pixelfed.cogip.be).
header_up X-Forwarded-For {remote}
Adds the X-Forwarded-For header, which passes the client’s IP address to the backend.
{remote} is a placeholder for the client’s IP (e.g., 203.0.113.1).
header_up X-Forwarded-Host {host}
Adds the X-Forwarded-Host header, which tells the backend the original domain requested by the client.
{host} is a placeholder for the domain (e.g., pixelfed.cogip.be).