Table of Contents
Overview
Recently, for some strange reasons, my Jenkins told me that my reversed proxy setup was broken. I use Caddy (to get automatic SSL) and forward all requests to a Jenkins docker instance running on my home machine. If you want more details, this post provides: https://www.jenkins.io/doc/book/system-administration/reverse-proxy-configuration-troubleshooting/
Correct Jenkins & Caddy Configuration
If you need just the config, here it is.
First, in Caddyfile, this is the configuration:
jenkins.my-domain.com { tls internal header X-Real-IP {remote} reverse_proxy JENKINS_DOCKER_IP_OR_NAME:PORT { header_up X-Forwarded-Host {host} header_up X-Forwarded-For {remote_host} header_up X-Forwarded-Proto https } }
Now you can run caddy reload
to load the changes.
In addition, you need to go to Manage Jenkins -> System and put your domain in:
Save the changes!
Now, you have a fully functional jenkins running on a SSL enabled website.
Conclusion
In this post, I’ve shown you how to setup Jenkins with Caddy.
I build softwares that solve problems. I also love writing/documenting things I learn/want to learn.