Hi everyone, I need help configuring certificates in Traefik based on whether traffic is coming from the internet or my local network. I'm using split DNS and want to have different entry points use different certificates and authentication methods.
So far, I've been using Let’s Encrypt, and everything worked fine, but now I want to hide my server’s identity from the internet using Cloudflare Proxy and Origin Certificates. Here’s my current config:
entryPoints:
web:
asDefault: true
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
asDefault: true
address: ":443"
http:
tls:
certResolver: le
domains:
- main: "example.org"
sans:
- "*.example.org"
http3: {}
public:
address: ":8443"
http:
tls: {}
middlewares:
- "xxx@file"
- "xxx@file"
What I Want to Achieve:
- web and websecure should work as they currently do, handling internal traffic using Let’s Encrypt certificates.
- public should use Cloudflare Origin Certificates to hide the server's identity for traffic coming from the internet, routed via Cloudflare.
The Problem:
When I try to use Cloudflare certificates for public, I’m facing a couple of issues depending on configuration:
- websecure also starts using Cloudflare certificates, which blocks access from my local network, where I want to keep using Let’s Encrypt.
- Attempting to use
certificateStore
doesn’t fix the issue because Traefik seems to ignore this configuration with dynamic certificates (as per documentation).
I want Traefik to differentiate certificates based on where the traffic is coming from (split DNS):
- Internet traffic through Cloudflare should use the Cloudflare Origin Certificate on public.
- Internal traffic should continue using Let’s Encrypt on websecure.
The Question:
How can I configure Traefik to properly handle certificates based on entry points and traffic sources (split DNS)? How do I get Cloudflare Origin Certificates to work only on the public entry point without affecting the rest of the traffic?
Thanks in advance for the help!