You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lawrence S K Ong <la...@gmail.com> on 2010/11/12 04:04:23 UTC

[users@httpd] mod_proxy_http and input filters

Can someone please help me with this issue?

I have recently created an input filter.  This input filter was created to
modify the POST uri on the condition that the body matches a certain
string.  After the uri is modified, mod_proxy_http would send the correct
POST uri to the backend server.  Yes, this worked and the correct uri is
sent to the backend server.  However, when there are two ProxyPass
configuration, there is an issue.

For example:

ProxyPass /altlocation http://serverA/altlocation
ProxyPass / http://defaultServer/

The input filter converts the original URI to /altlocation if the body
matches a certain condition.

The issue is that I always hit http://defaultServer/ rather than
http://serverA/altlocation.  It seems that this issue is occuring because
the determination of which server to proxy to is performed after the header
is sent, and not after the body arrives.

Does anyone know how I can avoid this?

Thanks,
Lawrence

Re: [users@httpd] mod_proxy_http and input filters

Posted by Lawrence S K Ong <la...@gmail.com>.
Igor,

Thanks for the reply.

Sorry, I did not include ProxyPassReverse in my initial post.  The full
"proxy" configurations are:

ProxyPass /altlocation http://serverA/altlocation<http://servera/altlocation>
ProxyPass / http://defaultServer/ <http://defaultserver/>
ProxyPassReverse / http://defaultServer/

As for the input filter, it is activated the moment that it is loaded.  So
what I have is:

LoadModule myif_module /usr/lib64/httpd/modules/mod_myif.so

Inside the code of the module itself, there are no "configuration"
parameters, just a register filter immediately:

static void register_hooks(apr_pool_t *p)
{
    ap_register_input_filter("MYIF_IN", myif_filter_in, NULL,
                             AP_FTYPE_CONNECTION);
    ap_hook_pre_connection(myif_pre_conn, NULL, NULL, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA myif_module = {
    STANDARD20_MODULE_STUFF,
    NULL,                    /* create per-directory config structure */
    NULL,                    /* merge per-directory config structures */
    NULL,                    /* create per-server config structure */
    NULL,                    /* merge per-server config structures */
    NULL,                    /* command apr_table_t */
    register_hooks           /* register hooks */
};

Let me know if you require further information and thanks for the reply.

Lawrence

2010/11/17 Igor Galić <i....@brainsware.org>

>
> ----- "Lawrence S K Ong" <la...@gmail.com> wrote:
>
> > Can someone please help me with this issue?
> >
> > I have recently created an input filter. This input filter was created
> > to modify the POST uri on the condition that the body matches a
> > certain string. After the uri is modified, mod_proxy_http would send
> > the correct POST uri to the backend server. Yes, this worked and the
> > correct uri is sent to the backend server. However, when there are two
> > ProxyPass configuration, there is an issue.
> >
> > For example:
> >
> > ProxyPass /altlocation http://serverA/altlocation
> > ProxyPass / http://defaultServer/
>
> This just shows us how you configured the proxy, which is all fine
> (Except maybe for missing the ReverseProxyPass, see
> http://www.apachetutor.org/admin/reverseproxies for a fully
> working example; you can probably ignore the mod_proxy_html part)
>
> > The input filter converts the original URI to /altlocation if the body
> > matches a certain condition.
>
> It does not however, show us how, exactly, you configured your
> input filter.
>
> > The issue is that I always hit http://defaultServer/ rather than
> > http://serverA/altlocation . It seems that this issue is occuring
> > because the determination of which server to proxy to is performed
> > after the header is sent, and not after the body arrives.
> >
> > Does anyone know how I can avoid this?
> >
> > Thanks,
> > Lawrence
>
>
> i
>
> --
> Igor Galić
>
> Tel: +43 (0) 664 886 22 883
> Mail: i.galic@brainsware.org
> URL: http://brainsware.org/
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] mod_proxy_http and input filters

Posted by Igor Galić <i....@brainsware.org>.
----- "Lawrence S K Ong" <la...@gmail.com> wrote:

> Can someone please help me with this issue?
> 
> I have recently created an input filter. This input filter was created
> to modify the POST uri on the condition that the body matches a
> certain string. After the uri is modified, mod_proxy_http would send
> the correct POST uri to the backend server. Yes, this worked and the
> correct uri is sent to the backend server. However, when there are two
> ProxyPass configuration, there is an issue.
> 
> For example:
> 
> ProxyPass /altlocation http://serverA/altlocation
> ProxyPass / http://defaultServer/

This just shows us how you configured the proxy, which is all fine
(Except maybe for missing the ReverseProxyPass, see
http://www.apachetutor.org/admin/reverseproxies for a fully
working example; you can probably ignore the mod_proxy_html part)

> The input filter converts the original URI to /altlocation if the body
> matches a certain condition.

It does not however, show us how, exactly, you configured your
input filter.

> The issue is that I always hit http://defaultServer/ rather than
> http://serverA/altlocation . It seems that this issue is occuring
> because the determination of which server to proxy to is performed
> after the header is sent, and not after the body arrives.
> 
> Does anyone know how I can avoid this?
> 
> Thanks,
> Lawrence


i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org