Per-hostname authenticated origin pulls
When you enable Authenticated Origin Pulls per hostname, all proxied traffic to the specified hostname is authenticated at the origin web server. You can use client certificates from your Private PKI to authenticate connections from Cloudflare.
1. Upload custom certificate
First, follow the API instructions to upload a custom certificate to Cloudflare, but use the /origin_tls_client_auth/hostnames/certificates
endpoint.
In the API response, save the certificate id
since it will be required in step 4.
2. Configure origin to accept client certificates
With the certificate installed, set up your origin web server to accept client certificates.
Check the examples below for Apache and NGINX or refer to your origin web server documentation - e.g. HAProxy, Traefik, Caddy. For this example, you would have saved the certificate For this example, you would have saved your certificate to Apache example
/path/to/origin-pull-ca.pem
.NGINX example
/etc/nginx/certs/cloudflare.crt
.
At this point, you may also want to enable logging on your origin so that you can verify the configuration is working.
3. Enable Authenticated Origin Pulls (globally)
Then, enable the Authenticated Origin Pulls feature as an option for your Cloudflare zone.
This step sets the TLS Client Auth to require Cloudflare to use a client certificate when connecting to your origin server.
To enable Authenticated Origin Pulls in the dashboard:
- Log in to your Cloudflare account and go to a specific domain.
- Go to SSL/TLS > Origin Server.
- For Authenticated Origin Pulls, switch the toggle to On.
To enable or disable Authenticated Origin Pulls with the API, send a PATCH
request with the value
parameter set to your desired setting ("on"
or "off"
).
4. Enable Authenticated Origin Pulls for the hostname
Use the Cloudflare API to send a PUT
request to enable Authenticated Origin Pulls for specific hostnames.
If you had set up logging on your origin during step 2, test and confirm that Authenticated Origin Pulls is working.
5. Enforce validation check on your origin
Once you can confirm everything is working as expected for your specific origin setup, configure your origin to enforce the authentication.Apache example
NGINX example
After completing the process, you can use curl
to send requests directly to your origin IPs, verifying that the requests fail due to certificate validation being enforced.