Getting Caddy Server to work properly with Wordpress

1. Caddy version (2.4.6):

2. How I run Caddy:

Caddy run

a. System environment:

Raspberry Pi and macOS

b. Command:

Caddy run

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config:, {
        log {
                output file /Users/glen/var/log/caddy/fuzarooms.log

And, {
        root * /users/glen/public/www/fuzavue
        encode gzip
        log {
                output file /Users/glen/var/log/caddy/fuzavue.log

3. The problem I’m having:

This is the only setup I’ve found that will let the website work properly. If i remove http from the second caddyfile and change the site to HTTPS in Wordpress settings, website loads with “Too many redirects”

4. Error messages and/or full log output:

Too many redirects

5. What I already tried:

Changing http to https

6. Links to relevant resources:

Thanks for the help, im not sure what more to do.

I’m confused – are you running two instances of Caddy, one proxying to the other?

If so, it’s correct to use http:// for the upstream one. The one in front will terminate TLS and proxy to the other over HTTP.

Correct, the first caddy server takes in all requests, the routes the request to the correct server.

So do I need to keep it in Wordpress settings? Having it listed as http instead of https in Wordpress settings is causing other issues, but if i change it to https in Wordpress settings, I get “Too many redirects”

I don’t use WordPress, but this sounds like a config issue with WordPress itself. Google for stuff like “WordPress behind TLS proxy” or similar, you should find what you need. If it’s a guide for Nginx, it’ll mostly still apply. Caddy will already send the X-Forwarded-Proto: https header upstream, so you just need to make sure that’s handled properly by WordPress so that it knows the request was already HTTPS.

Got it working, turns out is had nothing to do with Caddy, it was Wordpress + CloudFlare

If anyone runs into this issue, be sure to install this plugin (Flexible SSL for CloudFlare – WordPress plugin | and then change from http to https in Wordpress settings.

Thanks again!

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.