By the way, usually rewriting to an index file as you’re doing is a red flag, since Caddy enforces canonical URLs (/index.php == /) – thus, you should not rewrite to a path that will return a redirect (index.*); instead, rewrite to /
.
HI Matt,
you’ve lost me… this was in my earlier posts? Can you be more specific so I can understand?
Thanks!
To clarify, your rewrite from earlier (that I advised you remove entirely and leave the routing/rewriting to the upstream proxy target):
rewrite {
if {path} not_match ^\/wp-admin
to {path} {path}/ /index.php?{query}
}
}
See how the fallback target is /index.php?{query}
?
The canonical way to make that request is just /?{query}
, because the index file is already given for a request for the directory.
If Caddy’s static fileserver component is given the chance to fulfill the request, it will issue a permanent redirect to the proper style of index request. It won’t get the chance, because proxy
and fastcgi
both send the request upstream before the static fileserver does anything - but it’s still not technically correct.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.