You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jeff Trawick <tr...@gmail.com> on 2014/06/11 15:55:30 UTC

Re: [users] mod_proxy_fcgi with Plack, customizing script vars in general

On Mon, Jun 9, 2014 at 9:34 PM, Yehuda Katz <ye...@ymkatz.net> wrote:

> Plack requires SCRIPT_NAME to be "" instead of "/" (
> https://github.com/plack/Plack/issues/308).
> Is there a way to do this with Apache 2.4.7?
>
> My current config is
> ProxyPass / fcgi://localhost:9090/
>
> - Y
>

I don't think it is possible to set SCRIPT_NAME to the empty string at
present, unless there is some way through this logic in ap_add_cgi_vars()
with values for r->uri which I don't anticipate:

    else if (!r->path_info || !*r->path_info) {
        apr_table_setn(e, "SCRIPT_NAME", r->uri);
    }
    else {
        int path_info_start = ap_find_path_info(r->uri, r->path_info);

        apr_table_setn(e, "SCRIPT_NAME",
                      apr_pstrndup(r->pool, r->uri, path_info_start));

        apr_table_setn(e, "PATH_INFO", r->path_info);
    }

While this particular issue seems to be a strange requirement of Plack, in
general I think that configuring values/expressions for script variables
would help in a number of circumstances.  I could see something like

SetScriptEnv SCRIPT_NAME|PATH_INFO|GATEWAY_INTERFACE|REQUEST_URI|...
<expression>

allowing you to override the logic in ap_add_cgi_vars() and
ap_add_common_vars() for specific variables.  nginx has something similar
as the default mechanism for setting such variables, and the growing (and
sometimes near-exclusive within certain communities) use of nginx in this
space sometimes results in app|middleware expectations (good or bad) that
can be easily met with nginx but not so with httpd.

Any thoughts out there on a SetScriptEnv directive?  I don't know the
.htaccess considerations here.  On the one hand, an app is free to
ignore/override any or all values anyway, but if someone untrusted has the
ability to enable only trusted apps then this seems potentially dangerous.

-- 
Born in Roswell... married an alien...
http://emptyhammock.com/
http://edjective.org/