From 832df649c1127f301e9d67a8fc4e739be433500e Mon Sep 17 00:00:00 2001 From: MisterDuval Date: Fri, 15 Nov 2019 20:54:39 +0100 Subject: [PATCH] fastcgi: Case-insensitive extension comparison --- caddyhttp/fastcgi/fastcgi.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/caddyhttp/fastcgi/fastcgi.go b/caddyhttp/fastcgi/fastcgi.go index f0e5327c..aab0ecdd 100644 --- a/caddyhttp/fastcgi/fastcgi.go +++ b/caddyhttp/fastcgi/fastcgi.go @@ -102,7 +102,8 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) } // These criteria work well in this order for PHP sites - if !h.exists(fpath) || fpath[len(fpath)-1] == '/' || strings.HasSuffix(fpath, rule.Ext) { + // We lower path and Ext as on Windows, the system is case insensitive, so .PHP is served as .php + if !h.exists(fpath) || fpath[len(fpath)-1] == '/' || strings.HasSuffix(strings.ToLower(fpath), strings.ToLower(rule.Ext)) { // Create environment for CGI script env, err := h.buildEnv(r, rule, fpath)