Wordpress preview breaks with Caddy

1. My Caddy version (caddy -version):

Caddy v1.0.4 (h1:wwuGSkUHo6RZ3oMpeTt7J09WBB87X5o+IZN4dKehcQE=)

2. How I run Caddy:

sudo -u www-data caddy -conf /etc/caddy/Caddyfile
sudo caddy -conf /etc/caddy/Caddyfile

(tried both)

a. System environment:

Ubuntu 18.04, no docker

b. Command:

see how I run caddy

d. My complete Caddyfile: {
 #   tls admin@example.com
    root /var/www/wordpress
    fastcgi / /run/php/php7.3-fpm.sock php
    # Prevent malicious PHP uploads from running
    rewrite {
        r /uploads\/(.*)\.php
        to /

    rewrite {
        if {path} not_match ^\/wp-admin
        to {path} {path}/ /index.php?_url={uri}

3. The problem I’m having:

When using Wordpress with Caddy, the ‘preview’ feature of Wordpress does not work,
when I switch to wp-cli’s “wp server” command it works fine.

When I say it does not work, you edit a page in wordpress, and hit ‘Preview’ in the page you are editing.
Correct behavior is a ‘preview’ of the edited page refreshes or opens in another tab with the changes you just made.
The incorrect behavior, which is happening to me, is the page refreshes or opens in another tab WITHOUT any of the edits/changes I just made.
I am suspecting a headers/caching issue or something related.

If I use the wp-cli wrapper around php -S everything works expected, so I again, suspect caching or headers issues that I don’t understand yet.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.