Is it somehow possible to use cutelyst-wsgi and it's FastCGI socket together with Apache's mod_proxy_fcgi? I tried any weird combination of settings for a proxy including SetHandler in many combinations as well as ProxyPass, but nothing wants to work. cutelyst-wsgi every time only seems to get the root "/" url, not the other parts of the URI, like in the following endless redirect:
925:925 cutelyst.core[info] cutelyst-wsgi powered by Cutelyst 1.6.0, Qt 5.7.1.
925:925 wsgi[debug] Starting threads
925:925 cutelyst.request[debug] "GET" request for "/" from "127.0.0.1"
925:925 cutelyst.dispatcher[debug] Path is "/"
925:925 cutelyst.response[debug] Redirecting to "http://localhost/login" 302
925:925 cutelyst.stats[debug] Response Code: 302; Content-Type: text/html; charset=utf-8; Content-Length: 297
925:925 cutelyst.stats[info] Request took: 0.001000s (1000.000/s)
.--------+-----------.
| Action | Time |
.--------+-----------.
| /Auto | 0.001000s |
| /End | 0.000000s |
.--------+-----------.
925:925 cutelyst.request[debug] "GET" request for "/" from "127.0.0.1"
925:925 cutelyst.dispatcher[debug] Path is "/"
925:925 cutelyst.response[debug] Redirecting to "http://localhost/login" 302
925:925 cutelyst.stats[debug] Response Code: 302; Content-Type: text/html; charset=utf-8; Content-Length: 297
925:925 cutelyst.stats[info] Request took: 0.001000s (1000.000/s)
And so on until Firefox stops it.
Using the script from this Apache bug report I tried to determine which stuff is send to the socket when calling the example url http://localhost/path/to/my/3/controllers?foo=bar
This is the output without setting proxy-fcgi-pathinfo.
$VAR1 = {
'DOCUMENT_ROOT' => '/srv/www/htdocs',
'HTTP_HOST' => 'localhost',
'SCRIPT_NAME' => '/path',
'SCRIPT_FILENAME' => '/srv/www/htdocs/path',
'SERVER_SIGNATURE' => '',
'SERVER_ADMIN' => '[no address given]',
'FCGI_ROLE' => 'RESPONDER',
'PATH_TRANSLATED' => '/srv/www/htdocs/to/my/3/controllers',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0',
'HTTP_ACCEPT_LANGUAGE' => 'de-DE,de;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2',
'PATH_INFO' => '/to/my/3/controllers',
'QUERY_STRING' => 'foo=bar',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
'HTTP_CONNECTION' => 'keep-alive',
'REQUEST_METHOD' => 'GET',
'HTTP_UPGRADE_INSECURE_REQUESTS' => '1',
'REQUEST_URI' => '/path/to/my/3/controllers?foo=bar',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'CONTEXT_DOCUMENT_ROOT' => '/srv/www/htdocs',
'SERVER_SOFTWARE' => 'Apache',
'SERVER_ADDR' => '127.0.0.1',
'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'SERVER_PORT' => '80',
'HTTP_DNT' => '1',
'REMOTE_PORT' => '58456',
'REQUEST_SCHEME' => 'http',
'REMOTE_ADDR' => '127.0.0.1',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'CONTEXT_PREFIX' => '',
'SERVER_NAME' => 'localhost'
};
And this is the output with enabling proxy-fcgi-pathinfo:
$VAR1 = {
'SERVER_NAME' => 'localhost',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'CONTEXT_PREFIX' => '',
'REMOTE_ADDR' => '127.0.0.1',
'REMOTE_PORT' => '58464',
'REQUEST_SCHEME' => 'http',
'HTTP_DNT' => '1',
'SERVER_PORT' => '80',
'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'SERVER_ADDR' => '127.0.0.1',
'proxy-fcgi-pathinfo' => '1',
'CONTEXT_DOCUMENT_ROOT' => '/srv/www/htdocs',
'SERVER_SOFTWARE' => 'Apache',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'REQUEST_URI' => '/path/to/my/3/controllers?foo=bar',
'REQUEST_METHOD' => 'GET',
'HTTP_UPGRADE_INSECURE_REQUESTS' => '1',
'PATH_INFO' => '/to/my/3/controllers',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
'QUERY_STRING' => 'foo=bar',
'HTTP_CONNECTION' => 'keep-alive',
'FCGI_ROLE' => 'RESPONDER',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0',
'PATH_TRANSLATED' => '/srv/www/htdocs/to/my/3/controllers',
'HTTP_ACCEPT_LANGUAGE' => 'de-DE,de;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2',
'SERVER_ADMIN' => '[no address given]',
'SERVER_SIGNATURE' => '',
'SCRIPT_FILENAME' => '/srv/www/htdocs/path',
'SCRIPT_NAME' => '/path',
'HTTP_HOST' => 'localhost',
'DOCUMENT_ROOT' => '/srv/www/htdocs'
};
I am not sure where to search for this issue. I am using mod_proxy_fcgi together with PHP-FPM without any problems. But might also be, that I am using a completely wrong configuration for Cutelyst. :)