Problems running multiple Perl CGI scripts using http.CGI plugin

What up B, this is my first post here and I’ll continue posting.

I’m trying to run a script in a different folder. When I do so, Caddy either returns a file not found, firefox returns a file not found, or it runs but not correctly, depending on the set up.

Currently, this is what I have:

site {
root folder
cgi {
match /*.cgi
exec {.}/{match}
}
cgi /*/upload.cgi {.}/{match}
}

What’s happening with the second script is it runs, but not in the folder it’s in. When I try creating a new site though, it runs partially (it’s running at the same time as the other):

site/new {
    root folder/new
    cgi /upload.cgi /{match}
}

The first call for cgi works perfectly, the second however, doesn’t run or doesn’t run in the folder it’s supposed to. What do?

What’s happening with the second script is it runs, but not in the folder it’s in.

CGI does not change the script’s working directory. If you need to do that, it should be done within your script.

Say Caddy’s default working directory is /caddy. A request for /foo.cgi will result in the first CGI instance attempting to run /caddy/foo.cgi. A request for /bar/upload.cgi will result in the second CGI instance attempting to run /caddy/bar/upload.cgi. And, for the site/new example, a request for /upload.cgi will result in the execution of /upload.cgi.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.