1. The problem I’m having:
I run 2.6.2-5 on Debian 12 and php8.2-fpm with Wordpress latest + Woocommerce 8.5.0. Nearly everything runs fine, except the restAPI calls of the cart and checkout page makes problems. Unsure if it is my fault or a bug, but I would like to stay with Caddy not being forced to Apache if possible. I have 10+ hours searching with it and now I run out of ideas. Any hint to make the cart working would be greatly appreciated. Thank you.
This was opened Woocommerce in Subdir RestAPI Problem with Caddy · Issue #6034 · caddyserver/caddy · GitHub but I was redirected here.
2. Error messages and/or full log output:
Setup:
/var/www/svc.example.com-SSL/somdir/ → here is wordpress
Caddyfile:
svc.example.com:443 {
root * /var/www/svc.example.com-SSL
php_fastcgi localhost:9000 {
root /var/www/svc.example.com-SSL
}
file_server
encode zstd gzip
log {
output file /var/log/caddy/svc.example.com-SSL.access.log {
roll_size 30MB
roll_keep 5
roll_keep_for 240h
}
}
# Prevent access to dot-files, except .well-known
@dotFiles {
path */.*
not path /.well-known/*
}
@blockedext {
path *.orig *.patch *README *.txt *.git *.md *.dist *.yml *.conf *.json *Dockerfile /protected/
}
respond @blockedext 404
@static {
file
path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.pdf *.webp
}
header @static Cache-Control max-age=5184000
tls hostmaster@example.com {
protocols tls1.2 tls1.3
}
##############################################################
# Wordpress on /somedir
##############################################################
@disallowed {
path *xmlrpc.php
path *.sql
path /somedir/wp-content/uploads/*.php
}
respond @disallowed 404
@wccart {
path /wc/store/v1/cart
}
redir @wccart /somedir/index.php/wp-json/wc/store/v1/cart?{query}
@wcbatch {
path /wc/store/v1/batch
}
redir @wcbatch /somedir/index.php/wp-json/wc/store/v1/batch?{query}
@wc {
path not /wc/store/v1/batch
path not /wc/store/v1/batch
path /wc/*
path wc/*
}
redir @wc /somedir/index.php/wp-json/{uri}?{query}
}
I already redirect /wc (unsure why this is called wrong from the woocommerce side in this setup) and from this changes on the cart call worked. and th v1 json also included batch, but responds with 404.
2024-01-11 15:03:07|null|/wc/store/v1/batch?_locale=user|POST|HTTP/2.0|302|Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:113.0) Gecko/20010101 Firefox/113.0
2024-01-11 15:03:08|null|/somedir/index.php/wp-json/wc/store/v1/batch?_locale=user|GET|HTTP/2.0|404|Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:113.0) Gecko/20010101 Firefox/113.0
2024-01-11 15:02:54|null|/wc/store/v1/cart?_locale=user|GET|HTTP/2.0|302|Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:113.0) Gecko/20010101 Firefox/113.0
2024-01-11 15:02:55|null|/somedir/index.php/wp-json/wc/store/v1/cart?_locale=user|GET|HTTP/2.0|200|Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:113.0) Gecko/20010101 Firefox/113.0
here is a copy of https://svc.example.com/wc/store/v1 which is correct redirected and includes the batch endpoint as it looks like:
the forum does not let me post > 30K so i refer to
Woocommerce in Subdir RestAPI Problem with Caddy · Issue #6034 · caddyserver/caddy · GitHub for the json list
NOTE: doman and subdir is replaced by search & replace. it was m y d o m a i n, but got an error not letting me post. so i replaced again with example.
3. Caddy version:
I run 2.6.2-5 on Debian 12 and php8.2-fpm with Wordpress latest + Woocommerce 8.5.0.
4. How I installed and ran Caddy:
see above
a. System environment:
Debian 12, MariaDB, Systemd, no Docker