Skip to content

Disabling environment detection

bellaire edited this page Jan 26, 2011 · 2 revisions

Mojo normally attempts to detect your environment (e.g. CGI, FastCGI, PSGI) when your app runs. You also have the option of passing an argument to start() to clue Mojo as to which environment to assume if detection fails.

Mojolicious::Commands->start('fastcgi');

For practical reasons, though, if detection succeeds, Mojo will always use the detected environment rather than any argument passed to start. For example, Apache CGI will pass the query string as an argument to the application, which is not desirable and a potential security vulnerability.

However, some users may be running in a very unusual, non-standard environment such that while detection succeeds, it is not correct. For example, if using cgi-fcgi to enable FastCGI under Apache with an suexec CGI environment, Mojo will detect the environment as CGI and will not persist as an FCGI process, even if fastcgi is passed to start as above. If you are absolutely certain that you want to disable detection, and have Mojo use the environment you pass as an argument, do something like this:

$ENV{MOJO_NO_DETECT} = 1;
Mojolicious::Commands->start('fastcgi');

This will disable environment detection in favor of the argument passed in.

Clone this wiki locally