Page MenuHomePhabricator

CGI script downloads instead of executing
Closed, ResolvedPublic

Description

My tool is a perl cgi-script:
https://citation-template-filling.toolforge.org/cgi-bin/index.cgi

Very recently, the above link now downloads instead of executing the script. The problem may be related to:
https://stackoverflow.com/questions/28138997/cgi-script-downloads-instead-of-running

Note that I have followed the instructions for the new DNS domain name:
https://wikitech.wikimedia.org/wiki/News/Toolforge.org

From tools.citation-template-filling@tools-sgebastion-07:
I also stopped and restarted the service:
$ webservice --backend=gridengine lighttpd stop
$ rm service.manifest
$ webservice --backend=gridengine lighttpd start
or
$ webservice --backend=gridengine --canonical lighttpd start

But the script still downloads instead of executes. Is there something in my installation that needs to be modified?

Event Timeline

@Boghog: I assume this is about Toolforge. (Please add projects so tasks can be found - thanks!)

$:foo\> curl https://citation-template-filling.toolforge.org/cgi-bin/index.cgi -I | grep content-type
content-type: application/octet-stream

It looks like your code should fix its Content-Type response header (e.g. to be text/html or whatever is appropriate).

OK, Majavah added the project: Toolforge. Thanks.

The Content-Type (application/octet-stream) is a symptom, not the cause. What should happen (and has happened for many years) is the cgi script is executed by the server. For the first time, yesterday, the cgi script is downloaded. Given the timing, I assume this is somehow connected to the DNS name change.

The problem may be related to:
https://stackoverflow.com/questions/28138997/cgi-script-downloads-instead-of-running

In which case, apache cgi.load not being installed on the server might be the cause.

Legoktm claimed this task.
Legoktm subscribed.

Your tool had a .lighttpd.conf with the following:

$HTTP["url"] =~ "^/citation-template-filling/cgi-bin" {
        cgi.assign = ( "" => "" )
    }

I removed the /citation-template-filling prefix and now it works as expected.

Mentioned in SAL (#wikimedia-cloud) [2020-07-08T11:31:38Z] <wm-bot> <root> fix .lighttpd.conf after domain switch (T257421)

@Legoktm

Perfect! Thank you for your quick and effective response.