You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/manual/how-tos/caddy.rst
+18-50Lines changed: 18 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -9,20 +9,17 @@ Caddy: Reverse Proxy
9
9
Features
10
10
--------
11
11
12
-
Caddy - The Ultimate Server - makes your sites more secure, more reliable, and more scalable than any other solution.
12
+
Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
13
+
13
14
By default, Caddy automatically obtains and renews TLS certificates (Let's Encrypt and ZeroSSL) for all your sites.
14
-
It's the most advanced HTTPS server in the world.
15
15
16
16
* Reverse Proxy HTTP, HTTPS and WebSockets
17
17
* Route UDP/TCP traffic with the included Layer4 module: https://github.com/mholt/caddy-l4
18
18
* Dynamic DNS module included: https://github.com/mholt/caddy-dynamicdns
19
-
* Large selection of DNS Providers available: https://github.com/caddy-dns
19
+
* Cloudflare DNS Provider included: https://github.com/caddy-dns/cloudflare
20
20
21
21
WWW: https://caddyserver.com/
22
22
23
-
All available options and help-texts can be found on `Github <https://github.com/opnsense/plugins/tree/master/www/caddy/src/opnsense/mvc/app/controllers/OPNsense/Caddy/forms>`_
24
-
25
-
26
23
------------
27
24
Installation
28
25
------------
@@ -86,7 +83,7 @@ Standard Configuration
86
83
Creating a Simple Reverse Proxy
87
84
-------------------------------
88
85
89
-
.. Attention:: The domain has to be externally resolvable. Create an A-Record with an external DNS Provider that points your domain to the external IP address of your OPNsense.
86
+
.. Attention:: The domain has to be externally resolvable. Create an A-Record on a public DNS server that points your domain to the external IP address of your OPNsense.
90
87
91
88
Go to :menuselection:`Services --> Caddy Web Server --> General Settings`
92
89
@@ -213,49 +210,16 @@ Now, all anonymous connections have to authenticate with Basic Auth before acces
213
210
Dynamic DNS
214
211
-----------
215
212
216
-
.. Attention::
217
-
218
-
DNS modules are community maintained: `Caddy DNS <https://github.com/caddy-dns>`_
219
-
220
-
There are built-in and optional providers. Built in providers will work out of the box (e.g. Cloudflare).
221
-
Optional providers must be manually installed via CLI.
222
-
If the caddy binary changes version, any optional package must reinstalled.
* Edit a domain or subdomain and enable the `Dynamic DNS` checkbox.
259
223
* Press **Save** and **Apply**
260
224
261
225
Check the Logfile for the DynDNS updates. Set it to `Informational` and search for the chosen domain.
@@ -278,18 +242,19 @@ Check the Logfile for the DynDNS updates. Set it to `Informational` and search f
278
242
Wildcard Domain with Subdomains
279
243
-------------------------------
280
244
281
-
.. Tip:: For `DNS Providers` like `Cloudflare`, this is the recommended setup.
245
+
.. Tip:: For `Cloudflare`, this is the recommended setup.
282
246
283
247
.. Note:: If you use :ref:`Dynamic DNS <dynamicdns-opnsense-caddy>`, subdomains are needed due to the way the API updates the DNS Records in hosted zones.
284
248
285
249
Go to :menuselection:`Services --> Caddy Web Server --> General Settings --> DNS Provider`
286
250
287
-
* Select one of the supported `DNS Providers` from the list
288
-
* Input the `DNS API Key`, and any number of the additional required fields in `Additional Fields`. Read the full help for details.
251
+
* Select `Cloudflare` from the list
252
+
* Input the `API Key`
253
+
* Set `Resolvers` to ``1.1.1.1``
289
254
290
255
Go to :menuselection:`Services --> Caddy Web Server --> Reverse Proxy --> Domains`
291
256
292
-
* | Create ``*.example.com`` as domain and activate the `DNS-01 Challenge` checkbox. Alternatively, use a certificate imported or generated in :menuselection:`System --> Trust --> Certificates`. It has to be a wildcard certificate.
257
+
* | Create ``*.example.com`` as domain and activate the `DNS-01 Challenge` checkbox. Alternatively, use a certificate imported or generated in :menuselection:`System --> Trust --> Certificates`. It has to be a wildcard certificate. You could generate one with the os-acme-client plugin.
293
258
* | Create all subdomains in relation to the ``*.example.com`` domain, for example ``foo.example.com`` and ``bar.example.com``.
294
259
* | Check `Dynamic DNS` for the new subdomains, if needed.
295
260
@@ -299,6 +264,8 @@ Go to :menuselection:`Services --> Caddy Web Server --> Reverse Proxy --> Handle
299
264
300
265
.. Note:: The certificate of a wildcard domain will only contain ``*.example.com``, not a SAN for ``example.com``. If there is a service that should match ``example.com`` exactly, create an additional domain for ``example.com`` with an additional `Handler` for its upstream destination. Subdomains do not support setting ports, they will always track the ports of their assigned parent wildcard domain.
301
266
267
+
.. Tip:: For `Cloudflare`, set `Trusted Proxies` to the Cloudflare IP ranges and `Client IP Headers` to ``Cf-Connecting-Ip``.
Sometimes an application behind Caddy uses its own ACME Client to get certificates, most likely with the HTTP-01 challenge. This plugin has a built in mechanism to redirect this challenge type easily to a destination behind it.
347
314
348
-
Make sure the chosen domain is externally resolvable. Create an A-Record with an external DNS Provider that points to the external IP Address of the OPNsense. In case of IPv6 availability, it is mandatory to create an AAAA-Record too, otherwise the TLS-ALPN-01 challenge might fail.
315
+
Make sure the chosen domain is externally resolvable. Create an A-Record on a public DNS server that points to the external IP Address of the OPNsense. In case of IPv6 availability, it is mandatory to create an AAAA-Record too, otherwise the TLS-ALPN-01 challenge might fail.
349
316
350
317
The configured `Domain` must use an ``empty port`` or ``443`` in the GUI, otherwise it can not use the TLS-ALPN-01 challenge for itself. The upstream destination must listen on Port ``80`` and serve ``/.well-known/acme-challenge/``, for the same `Domain` that is configured in Caddy.
351
318
@@ -882,7 +849,8 @@ Caddy: Troubleshooting
882
849
FAQ
883
850
---
884
851
885
-
* | A `DNS Provider` is not required to get automatic certificates.
852
+
* | `Cloudflare` is not required to get automatic certificates.
853
+
* | You can use the os-acme-client plugin to generate wildcard certificates. Set up an automation in the ACME client that reloads Caddy (do not restart it).
886
854
* | `Port Forwards`, `NAT Reflection`, `Split Horizon DNS` or `DNS Overrides in Unbound` are not required. Only create Firewall rules that allow traffic to the default ports of Caddy.
887
855
* | Even though internal clients will use the external IP address to access the reverse proxied services, the traffic will not pass over the internet. It will stay inside the OPNsense. Only in rare cases where there is multi WAN, the traffic can be routed from one WAN interface to the other over the internet, due to `reply-to` settings.
888
856
* | Firewall rules to allow Caddy to reach internal services are not required. OPNsense has a default rule that allows all traffic originating from itself to be allowed.
@@ -922,7 +890,7 @@ Help, Nothing Works!
922
890
**1. Check the Infrastructure:**
923
891
924
892
* Do `A- and/or AAAA-Record` for all `Domains` and `Subdomains` exist?
925
-
* In case of activated :ref:`Dynamic DNS <dynamicdns-opnsense-caddy>`, check that the correct `A- and/or AAAA-Records` have been set automatically with the DNS Provider.
893
+
* In case of activated :ref:`Dynamic DNS <dynamicdns-opnsense-caddy>`, check that the correct `A- and/or AAAA-Records` have been set automatically with Cloudflare.
926
894
* Do they point to one of the external IPv4 or IPv6 addresses of the OPNsense Firewall? Check that with commands like ``nslookup example.com``
927
895
* Do the OPNsense `Firewall Rules` allow connections from `any` source to destination ports `80` and `443` to the destination `This Firewall`?
0 commit comments