Rewrite termination issues

Using the following caddyfile:

:80 {
    tls off
    root /var/www
    gzip
    rewrite {
        to {path} {path}/ /index.php?{query}
    }
    fastcgi / 172.18.0.1:9000 php {
        index index.php
    }
}

I have two files in the /var/www directory: index.php and foo.php. Using the above example, a request to http://mydomain.com/foo.php is returning index.php. My understanding was that Caddy would stop at the first match it found, but is seems that it always processes the last destination regardless of a previous match.

Any help would be greatly appreciated.

Are you running 0.10.2?

That rewrite should use foo.php if it’s available, otherwise foo.php/, otherwise index.php with the query string.

Yes, using Caddy 0.10.2.

Whoops. Forget I said anything. I did not actually have the foo.php file present.

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