aksdb / caddy-cgi

Common Gateway Interface plugin for the Caddy HTTP server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CGI error: fork/exec (File not found on Windows)

sinky opened this issue · comments

But i’m running on an error while runnning on windows.
It does not matter in which format I enter the exe/script.

C:\Windows\system32\hostname.exe does exist

Caddy version: v2.7.6

caddy run --config Caddyfile
2024/02/07 09:59:31.872 INFO    using provided configuration    {"config_file": "Caddyfile", "config_adapter": ""}
2024/02/07 09:59:31.876 INFO    admin   admin endpoint started  {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
2024/02/07 09:59:31.876 INFO    tls.cache.maintenance   started background certificate maintenance      {"cache": "0xc000130d00"}
2024/02/07 09:59:31.876 INFO    http.log        server running  {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2024/02/07 09:59:31.876 INFO    autosaved config (load with --resume flag)      {"file": "C:\\Users\\...\\AppData\\Roaming\\Caddy\\autosave.json"}
2024/02/07 09:59:31.877 INFO    serving initial configuration
2024/02/07 09:59:31.879 WARN    tls     storage cleaning happened too recently; skipping for now        {"storage": "FileStorage:C:\\Users\\...\\AppData\\Roaming\\Caddy", "instance": "0689bf7e-c42b-4533-9c97-07daf87cc2c0", "try_again": "2024/02/08 09:59:31.879", "try_again_in": 86400}
2024/02/07 09:59:31.879 INFO    tls     finished cleaning storage units
2024/02/07 09:59:33.781 INFO    CGI error: fork/exec .\hostname.exeC:\Windows\system32\hostname.exe: Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.

Caddyfile

{
	order cgi before respond
}

:2015

cgi /update hostname.exe {
	#script_name /script.cgi
}

Edit:
Outlput with "inspect"

CGI for Caddy inspection page

Executable .................... hostname.exe
Root .......................... /
Dir ........................... 
Environment
  PATH_INFO ................... /update
  REMOTE_USER ................. 
  SCRIPT_EXEC ................. hostname.exe 
  SCRIPT_FILENAME ............. hostname.exe
  SCRIPT_NAME ................. 
Inherited environment
Placeholders
  {path} ...................... /update
  {root} ...................... /
  {http.request.host} ......... localhost
  {http.request.method} ....... GET
  {http.request.uri.path} ..... /update

Does specifying a fully qualified path work?

Sorry i dont know what happend. It is now working as expexted with fully qualified path.
I could swear i tried it before