Help with Caddy Reverse Proxy Path Issue for WordPress Dashboard Under Subdirectory

1. The problem I’m having:

I’m trying to access my WordPress dashboard at Log In ‹ FrankenWP — WordPress through a reverse proxy configuration with Caddy. When I log into the dashboard, the path changes to https://finitetouchstudio.com/wp-admin/ instead of staying under /frankenwp. Attempting to access anything from https://finitetouchstudio.com/wp-admin/ results in a 404 error, as my main site (hosted with Ghost) is on https://finitetouchstudio.com/. I need help ensuring that WordPress stays under the /frankenwp path so I can access and use my dashboard without redirection issues. -

2. Error messages and/or full log output:

[No specific error message, but accessing `https://finitetouchstudio.com/wp-admin/` results in a 404 error.]

3. Caddy version:

v2.8.4 h1
/1nl4V4bxBrYoSoab7rL9BMYNk=

4. How I installed and ran Caddy:

Installed Caddy from Caddy Repository via apt

a. System environment:

OS: Ubuntu in digital ocean droplet
Relevant services: Caddy, Docker
Reverse proxy services for FrankenWP, phpMyAdmin, Ghost, Portainer, Rocket.Chat, and Jitsi Meet.

b. Command:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy -y

d. My complete Caddy config:

{
    email admin@finitetouchstudio.com
    acme_ca https://acme.zerossl.com/v2/DV90
}

finitetouchstudio.com {

     # FrankenWP Stack
    handle_path /frankenwp* {
        # Reverse proxy WordPress container running at localhost:8100
        reverse_proxy localhost:8100 {
            header_up X-Forwarded-Host {host}
            header_up X-Forwarded-Proto {scheme}
        }
    }

    # phpMyAdmin under FrankenWP
    handle_path /frankenwp/phpmyadmin/* {
        reverse_proxy localhost:8086 {
            header_up X-Forwarded-Host {host}
            header_up X-Forwarded-Proto {scheme}
        }
    }
    # Ghost Blog
    reverse_proxy localhost:2368

    # Portainer
    handle_path /portainer/* {
        reverse_proxy localhost:9000
    }

    # Rocket.Chat
    handle_path /rocketchat/* {
        reverse_proxy localhost:8500
    }

    # Jitsi Meet
    handle_path /jitsi/* {
        reverse_proxy localhost:8600
    }

    # Enable HTTPS with ZeroSSL certificate
    tls {
        ca https://acme.zerossl.com/v2/DV90
    }
}

Howdy @Labib, welcome to the Caddy community.

This sounds like The "subfolder problem", OR, "why can't I reverse proxy my app into a subfolder?"

Specifically, it sounds like you don’t have the WordPress Address and/or the Site Address set correctly in your WordPress settings, and as a result it’s redirecting you incorrectly.

1 Like