caddy run --config /srv/caddy/Caddyfile --adapter caddyfile
a. System environment:
macOS
d. My complete Caddyfile or JSON config:
3. The problem I’m having:
I need to reverse proxy a backend service (Jenkins). All users should be required to provide a basic auth login but some IP-ranges should be able to bypass this.
It’s not possible for me to implement another virtual host and to split both “views”.
With nginx there is a “satisfy” command available that solves this problem.
It is pretty easy, you just need to take a closer look at the documentation.
Here’s a few hints:
In Caddy v2, path matching is exact, so reverse_proxy / jenkins.intranet.example.com:8080 will only match requests to the root of your site. Instead, you should omit the / which is the same as specifying * as the matcher (i.e. any path). If you need a prefix-match, then you would do /prefix/*.
basicauth is a standard Caddy directive. If needs to be at the same level as reverse_proxy, not within it (subdirectives go within directives).
I’m intentionally not giving the copy+paste solution here because I’m trying to help our users learn how the software works. It’s a very simple fix, and it definitely is possible, with a slight change to your config. All it takes is a little understanding from the docs.
If you still can’t figure it out after trying for a few hours (hint: it should only take a few minutes of docs reading + a few seconds to make the change), then definitely come back and ask about what is still unclear, and we’ll help.