@@ -118,7 +118,12 @@ func (f *FrankenPHPModule) Provision(ctx caddy.Context) error {
118118 if len (f .SplitPath ) == 0 {
119119 f .SplitPath = []string {".php" }
120120 }
121- f .requestOptions = append (f .requestOptions , frankenphp .WithRequestSplitPath (f .SplitPath ))
121+
122+ if opt , err := frankenphp .WithRequestSplitPath (f .SplitPath ); err == nil {
123+ f .requestOptions = append (f .requestOptions , opt )
124+ } else {
125+ f .requestOptions = append (f .requestOptions , opt )
126+ }
122127
123128 if f .ResolveRootSymlink == nil {
124129 rrs := true
@@ -188,6 +193,10 @@ func (f *FrankenPHPModule) ServeHTTP(w http.ResponseWriter, r *http.Request, _ c
188193 repl := ctx .Value (caddy .ReplacerCtxKey ).(* caddy.Replacer )
189194
190195 documentRoot := f .resolvedDocumentRoot
196+
197+ opts := make ([]frankenphp.RequestOption , 0 , len (f .requestOptions )+ 4 )
198+ opts = append (opts , f .requestOptions ... )
199+
191200 if documentRoot == "" {
192201 documentRoot = repl .ReplaceKnown (f .Root , "" )
193202 if documentRoot == "" && frankenphp .EmbeddedAppPath != "" {
@@ -197,7 +206,7 @@ func (f *FrankenPHPModule) ServeHTTP(w http.ResponseWriter, r *http.Request, _ c
197206 // If we do not have a resolved document root, then we cannot resolve the symlink of our cwd because it may
198207 // resolve to a different directory than the one we are currently in.
199208 // This is especially important if there are workers running.
200- f . requestOptions = append (f . requestOptions , frankenphp .WithRequestDocumentRoot (documentRoot , false ))
209+ opts = append (opts , frankenphp .WithRequestDocumentRoot (documentRoot , false ))
201210 }
202211
203212 if f .preparedEnvNeedsReplacement {
@@ -206,7 +215,7 @@ func (f *FrankenPHPModule) ServeHTTP(w http.ResponseWriter, r *http.Request, _ c
206215 env [k ] = repl .ReplaceKnown (v , "" )
207216 }
208217
209- f . requestOptions = append (f . requestOptions , frankenphp .WithRequestPreparedEnv (env ))
218+ opts = append (opts , frankenphp .WithRequestPreparedEnv (env ))
210219 }
211220
212221 workerName := ""
@@ -220,7 +229,7 @@ func (f *FrankenPHPModule) ServeHTTP(w http.ResponseWriter, r *http.Request, _ c
220229 fr , err := frankenphp .NewRequestWithContext (
221230 r ,
222231 append (
223- f . requestOptions ,
232+ opts ,
224233 frankenphp .WithOriginalRequest (& origReq ),
225234 frankenphp .WithWorkerName (workerName ),
226235 )... ,
0 commit comments