1. Caddy version (caddy version
): 2
2. How I run Caddy:
On my VPS
a. System environment:
CentOS 8
b. Command:
caddy reload
#### c. Service/unit/compose file:
<!-- If using Docker/systemd/Kubernetes/make etc. -->
#### d. My complete Caddyfile or JSON config:
mysite.com, www.mysite.com {
root * /var/www/html/mysite
import /etc/caddy/caddy_security.conf
reverse_proxy localhost:6081
php_fastcgi unix//var/opt/remi/php74/run/php-fpm/www.sock
encode zstd gzip
file_server
header Strict-Transport-Security max-age=15552000
@static {
file
path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.woff2
}
header @static Cache-Control max-age=15552000
log {
output file /var/log/caddy/access.log
format single_field common_log
}
@secure {
file
path *.sql *.bak *.zip *.tgz *.tar.gz
}
respond @secure 404
}
### 3. The problem I'm having:
<!-- What are you trying to do, and what isn't working? Please describe the issue thoroughly enough so that anyone can reproduce the exact behavior you're seeing. Be as specific as possible. -->
Unable to make Varnish work with Caddy 2.
### 4. Error messages and/or full log output:
<!-- Please **DO NOT REDACT** any information except credentials. -->
Error too many redirects.
### 5. What I already tried:
<!-- Show us what effort you've put in to solving the problem. Be specific -- people are volunteering their time to help you! Low effort posts are not likely to get good answers! -->
I am trying to make varnish work on Caddy 2. However, I am getting error too many redirects problem on browser. I also have tried adding on wp-config.php:
define('FORCE_SSL_ADMIN', true);
$_SERVER['HTTPS']='on';
But the problem doesn't go off.
For my WordPress website.com its:
reverse_proxy localhost:6081
Then added:
localhost:80 {
root * /var/www/html/thatworkfast
php_fastcgi unix//var/opt/remi/php74/run/php-fpm/www.sock
file_server
}
Where:
backend default {
# .host = "127.0.0.1";
.host = "localhost";
.port = "80";
}
### 6. Links to relevant resources:
`https://gist.github.com/mwpastore/f42f6f1309a7b067519f4c08e18b0b6a`