httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: UDS support for mod_rewrite
Date Sun, 26 Jan 2014 21:34:30 GMT
proxy:fcgi is what mod_rewrite send and the patch
takes specific action to remove that 'proxy:' part.
Are you saying that PHP-FPM requires that the r->filename
AND the URL have that prepended? That seems weird
and wrong to me...

On Jan 26, 2014, at 10:49 AM, ryo takatsuki <ryotakatsuki@gmail.com> wrote:

> Hi,
> 
> I am checking the new patch (thanks again!) and I'm finding some issues trying to connect
to PHP-FPM using the socket. The problem seems to be that the filename sent to the proxy is
defined as "fcgi://localhost/..." where it usually is "proxy:fcgi://localhost/..." (being
the last form the one PHP expects).
> 
> It seems the "proxy:" prefix is stripped when the socket is extracted. The below patch
fixes it but I'm not sure is the best solution:
> 
> diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
> index fb6426b..909c384 100644
> --- a/modules/proxy/proxy_util.c
> +++ b/modules/proxy/proxy_util.c
> @@ -1959,8 +1959,8 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
>                      if (rv == APR_SUCCESS) {
>                          char *sockpath = ap_runtime_dir_relative(r->pool, urisock.path);
>                          apr_table_setn(r->notes, "uds_path", sockpath);
> -                        r->filename = ptr+1;    /* so we get the scheme for the uds
*/
> -                        *url = apr_pstrdup(r->pool, r->filename);
> +                        r->filename = apr_pstrcat(r->pool, "proxy:",ptr+1, NULL);
> +                        *url = apr_pstrdup(r->pool, ptr+1);
>                          ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
>                                        "*: rewrite of url due to UDS: %s", *url);
>                      }
> 
> 
> Regards,
> 
> Juanjo.
> 
> 
> 2014-01-22 Plüm, Rüdiger, Vodafone Group <ruediger.pluem@vodafone.com>
> Yes, forgot to mention this. You need to set at least one option get it created.
> 
>  
> 
> Regards
> 
>  
> 
> Rüdiger
> 
>  
> 
> Von: ryo takatsuki [mailto:ryotakatsuki@gmail.com] 
> Gesendet: Mittwoch, 22. Januar 2014 19:07
> An: dev@httpd.apache.org
> Betreff: Re: UDS support for mod_rewrite
> 
>  
> 
> Just a las quick comment about using a <Proxy> section to define the proxy. I could
not make it work using the below snippet:
> 
>  
> 
>          <Proxy "unix:/path/to/some.sock|fcgi://myserver">
> 
>          </Proxy>
> 
>  
> 
> Digging into the code, I realized the worker was only created if more arguments were
provided (which is not mentioned to be possible in the docs, or I could not find it):
> 
>  
> 
>          <Proxy "unix:/path/to/some.sock|fcgi://myserver" timeout=300 >
> 
>          </Proxy>
> 
>  
> 
> Then the worker is created and I can remove my extra "ProxyPass" directives. Is it intended
to only create the worker if we need to configure its settings?
> 
>  
> 
> It makes sense but it would be a good improvement to make the worker to be always created
if it does not exists, regardless of if some more settings are provided.
> 
>  
> 
> Sorry about the offtopic and thanks a lot to  Rüdiger for the hint!
> 
>  
> 
> 2014/1/22 ryo takatsuki <ryotakatsuki@gmail.com>
> 
> >Your "hack" has the additional benefit is being
> 
> >a pooled connection and not a one-shot, and therefore
> 
> >will have better performance. But that isn't related
> 
> >to UDS at all.
> 
>  
> 
> Well, it is related to UDS in the sense of being my solution to make my rewrites end
up serving content obtained through a Unix socket :). 
> 
>  
> 
> I initially had the old version of the UDS patch working with mod_rewrite (using the
default forward proxy worker) but it broke with newer versions of the patch so I figured out
that way of tricking mod_rewrite. 
> 
>  
> 
> Regarding using a <Proxy> section to define the workers, I see the code that should
be defining it but I'm not able to make it work. I will investigate it a little further, thanks!
> 
>  
> 
> Best regards,
> 
>  
> 
> Juanjo.
> 
>  
> 
> 2014/1/22 Daniel Ruggeri <DRuggeri@primary.net>
> 
> On 1/22/2014 5:48 AM, Juan José Medina Godoy wrote:
> > Do you think that approach is safe or is it likely to break at some
> > point? (relaying on the workers being located by url in that way,
> > without having to provide the socket in the rewrite)
> 
> Seems safe... and quite clever, actually.
> 
> --
> Daniel Ruggeri
> 
> 
> 
> 
>  
> 
> -- 
>  I've seen things you people wouldn't believe. 
> Attack ships on fire off the shoulder of Orion. 
> I watched C-beams glitter in the dark near Tannhauser Gate. 
> All those moments will be lost in time like tears in rain. 
> Time to die.
> 
> 
> 
> 
>  
> 
> -- 
>  I've seen things you people wouldn't believe. 
> Attack ships on fire off the shoulder of Orion. 
> I watched C-beams glitter in the dark near Tannhauser Gate. 
> All those moments will be lost in time like tears in rain. 
> Time to die.
> 
> 
> 
> 
> -- 
>  I've seen things you people wouldn't believe. 
> Attack ships on fire off the shoulder of Orion. 
> I watched C-beams glitter in the dark near Tannhauser Gate. 
> All those moments will be lost in time like tears in rain. 
> Time to die.


Mime
View raw message