fixing (docker) caddy + reverse proxy + UFW
here's an issue that i was having, and took me quite some time to figure out. probably just stemming from an issue of not properly understanding how docker networks, but that's in the past now.
the setup:
i was trying to use was a caddy docker container (in a vm) that is my reverse proxy whilst simultaneously having ufw running on the same machine running the caddy docker container. this is assuming your dns is set up and working correctly.
the error:
a network timeout io error message in the logs. disabling the firewall altogether would allow it to work as well, so it was some combination of the docker caddy reverse proxy with the ufw (hence the title of this post) that was causing the issue.
the fix:
credit to the post here, simply adding:
network_mode: "host"to the caddy block will enable it to use the regular ports that you have set up on your machine. potentially could be less secure, but from all the methods i tried (tried other reverse proxies, and also tried changing and joining networks), this was the easiest and allowed me to keep using caddy, which is quite easy to use.
alhamdulillah.