With the php preset for fastcgi, you shouldn’t get a 404 from PHP. Caddy should only be sending requests to PHP if the request is for a .php file or if it’s an index request with index.php present.
You can remove index index.php, it’s redundant with the php preset.
You can stop rewrite from affecting your proxy by excluding the proxy path from the rewrite.
rewrite {
if {path} not_starts_with /tv
to {path} {path}/ /
}
My understanding is that Caddy is sending a 404 status, but the body is coming from upstream (FastCGI), not the default one provided by Caddy (or a custom one if you’ve specified it).
Tagging @abiosoft, did anything come of that? I did a quick search for issues but nothing seemed strictly related.
Assuming there’s no issue currently tracked for this, @b2c, you may wish to open up a new one for the current behaviour to be changed.