You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having an issue with Apache using AddHandler to forward .php files to uwsgi through mod-proxy-uwsgi. All packages are the ones provided by Debian 12 bookworm.
However, everything works fine if I switch Apache to use FastCGI through the fastcgi-socket provided by uwsgi, and overriding PATH_INFO, with the following changes to the Apache config above:
The only difference I can see in the passed variables is that when using mod-proxy-uwsgi, PATH_INFO is passed as an absolute path and not a path relative to the document root, as is done for FCGI due to my PATH_INFO override above.
Apparently, uwsgi expects PATH_INFO to be relative to CONTEXT_DOCUMENT_ROOT. An strace shows this:
newfstatat(AT_FDCWD, "/home/test/www", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/home/test/www/home", 0x7ffc9ae360a0, 0) = -1 ENOENT (No such file or directory)
writev(8, [{iov_base="HTTP/1.1 404 Not Found\r\nConnecti"..., iov_len=71}, {iov_base="Not Found", iov_len=9}], 2) = 80
(It stops when it encounters the non-existant directory /home/test/www/home)
My question is, is there a way to either make uwsgi properly handle the absolute path in PATH_INFO, or alternatively have Apache send the relative PATH_INFO when using the mod_proxy_uwsgi module?
I've tried doing SetEnv / SetEnvIf to set PATH_INFO(similar to the ProxyFCGISetEnvIf above), but this appears to be ignored. I've also tried setting manage-script-name = true in uwsgi.ini, with no effect.
uwsgi does work fine when using ProxyPass, but this is not an adequate solution for us. We only want proxying to uwsgi for files, not locations, and to happen after Apache rewrites.
The text was updated successfully, but these errors were encountered:
@niol I don't think we're talking about the same issue. auto_prepend_file would never come into play in my case as uwsgi never gets to the point of invoking the PHP subsystem.
From what I can tell, for my specific case, the uwsgi PHP plugin fails because of this concatenation of document_root and path_info:
if (uwsgi_php_walk(wsgi_req, filename, wsgi_req->document_root, wsgi_req->document_root_len, &path_info)) {
I'm unfortunately not versed enough in the realm of CGI/WSGI/uwsgi to determine which part of the chain is "at fault" here, be it the Apache module or the PHP plugin, or maybe Apache itself.
Hello,
I am having an issue with Apache using
AddHandler
to forward.php
files to uwsgi throughmod-proxy-uwsgi
. All packages are the ones provided by Debian 12 bookworm./etc/apache/sites-enabled/test.conf
:/etc/uwsgi/test.ini
:/home/test/www/index.php
contains a test file. However, a request forhttp://localhost:8000/index.php
fails with404 Not Found
(from uwsgi).The request log, with the above format, returns this:
In other words:
However, everything works fine if I switch Apache to use FastCGI through the
fastcgi-socket
provided by uwsgi, and overridingPATH_INFO
, with the following changes to the Apache config above:Log line produced:
The only difference I can see in the passed variables is that when using
mod-proxy-uwsgi
,PATH_INFO
is passed as an absolute path and not a path relative to the document root, as is done for FCGI due to myPATH_INFO
override above.Apparently, uwsgi expects
PATH_INFO
to be relative toCONTEXT_DOCUMENT_ROOT
. An strace shows this:(It stops when it encounters the non-existant directory
/home/test/www/home
)My question is, is there a way to either make uwsgi properly handle the absolute path in
PATH_INFO
, or alternatively have Apache send the relativePATH_INFO
when using the mod_proxy_uwsgi module?I've tried doing
SetEnv
/SetEnvIf
to setPATH_INFO
(similar to theProxyFCGISetEnvIf
above), but this appears to be ignored. I've also tried settingmanage-script-name = true
inuwsgi.ini
, with no effect.uwsgi does work fine when using
ProxyPass
, but this is not an adequate solution for us. We only want proxying to uwsgi for files, not locations, and to happen after Apache rewrites.The text was updated successfully, but these errors were encountered: