You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 2014/05/30 16:08:51 UTC
Re: [users@httpd] Preserve protocol in httpd proxy
Hmmm... let me mull this over.
BTW: CCing on dev@
On May 29, 2014, at 11:18 AM, Juan Ignacio Barisich <ju...@gmail.com> wrote:
> I need to configure in Apache 2.4.9 (with mod_proxy and mod_proxy_wstunnel activated) a proxy with this mapping:
>
> - http://my.proxy/* --> http://my.backend:8080/*
> - ws://my.proxy/* --> ws://my.backend:8080/*
>
> E.g.:
>
> - ws://my.proxy/cometd-demo-2.8.0/cometd --> ws://my.backend:8080/cometd-demo-2.8.0/cometd
> - http://my.proxy/cometd-demo-2.8.0/cometd --> http://my.backend:8080/cometd-demo-2.8.0/cometd
> - http://my.proxy/cometd-demo-2.8.0/jquery-examples/chat/ --> http://my.backend:8080/cometd-demo-2.8.0/jquery-examples/chat/
>
> In other words, I need a proxy that keeps (preserves) the protocol.
>
> This configuration does not work:
>
> <VirtualHost *:80>
> ...
> ProxyRequests Off
> ProxyPreserveHost Off
> ProxyPass / http://my.backend:8080/
> ProxyPassReverse / http://my.backend:8080/
> </VirtualHost>
> because all request (no matter protocol) are proxied to http*
>
> Anyone knows how can I solve this?
>
> Thanks!
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Daniel Gruno <ru...@cord.dk>.
...Or with mod_lua at a 1/10th of the price of mod_rewrite if configured
properly :-)
# httpd.conf:
LuaMapToStorage /path/to/script.lua proxyhandler
-- script.lua:
function proxyhandler(r)
r.handler = "proxy-server"
r.proxyreq = apache2.PROXYREQ_REVERSE -- or whatever you like.
if r.headers_in['Upgrade'] == "WebSocket" then
r.filename = "proxy:ws://backend:8080" ..r.uri
else
r.filename = "proxy:http://backend:8080" ..r.uri
end
return apache2.OK
end
With regards,
Daniel.
On 05/31/2014 05:53 PM, Jim Jagielski wrote:
> I'm sure we can do w/ mod_rewrite... it's just that
> it's soo expensive :)
>
> On May 30, 2014, at 3:40 PM, Ruediger Pluem <rp...@apache.org> wrote:
>
>>
>>
>> Jim Jagielski wrote:
>>> Off the top of my head, I think we would need to
>>> add another proxypass option.
>>
>> Have you tried the following?
>>
>> RewriteEngine On
>> RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
>> RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
>> RewriteRule ^/(.*) http://my.backend:8080/$1 [P]
>>
>>
>>
>> Regards
>>
>> Rüdiger
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: [users] Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Maxim Solodovnik <so...@gmail.com>.
Hello All,
Couple of months passed since this question was answered
Are mod_rewrite/mod_lua still the only options to implement this? maybe
pod_proxy is now able to handle this?
Thanks in advance
On 2 June 2014 21:17, Juan Ignacio Barisich <ju...@gmail.com> wrote:
> Jim, thanks a lot.
> The configuration:
> > RewriteEngine On
> > RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
> > RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
> > RewriteRule ^/(.*) http://my.backend:8080/$1 [P]
>
> works fine for me :)
> What do you mean with "it's soo expensive" ?
> Is rewrite less performant ?
>
> Best regards
>
>
> 2014-05-31 12:53 GMT-03:00 Jim Jagielski <ji...@jagunet.com>:
>
> I'm sure we can do w/ mod_rewrite... it's just that
>> it's soo expensive :)
>>
>> On May 30, 2014, at 3:40 PM, Ruediger Pluem <rp...@apache.org> wrote:
>>
>> >
>> >
>> > Jim Jagielski wrote:
>> >> Off the top of my head, I think we would need to
>> >> add another proxypass option.
>> >
>> > Have you tried the following?
>> >
>> > RewriteEngine On
>> > RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
>> > RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
>> > RewriteRule ^/(.*) http://my.backend:8080/$1 [P]
>> >
>> >
>> >
>> > Regards
>> >
>> > Rüdiger
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>
--
WBR
Maxim aka solomax
[users] Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Juan Ignacio Barisich <ju...@gmail.com>.
Jim, thanks a lot.
The configuration:
> RewriteEngine On
> RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
> RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
> RewriteRule ^/(.*) http://my.backend:8080/$1 [P]
works fine for me :)
What do you mean with "it's soo expensive" ?
Is rewrite less performant ?
Best regards
2014-05-31 12:53 GMT-03:00 Jim Jagielski <ji...@jagunet.com>:
> I'm sure we can do w/ mod_rewrite... it's just that
> it's soo expensive :)
>
> On May 30, 2014, at 3:40 PM, Ruediger Pluem <rp...@apache.org> wrote:
>
> >
> >
> > Jim Jagielski wrote:
> >> Off the top of my head, I think we would need to
> >> add another proxypass option.
> >
> > Have you tried the following?
> >
> > RewriteEngine On
> > RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
> > RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
> > RewriteRule ^/(.*) http://my.backend:8080/$1 [P]
> >
> >
> >
> > Regards
> >
> > Rüdiger
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
auto works too :)
On Jun 11, 2014, at 9:50 AM, Yann Ylavic <yl...@gmail.com> wrote:
> On Wed, Jun 11, 2014 at 3:37 PM, Eric Covener <co...@gmail.com> wrote:
>> "auto"? Then e.g. proxy_ws can check for auto && Upgrade header.
>
> I'm fine with "auto" too ( since I definitively like C++11 :p ).
>
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Jun 11, 2014 at 3:37 PM, Eric Covener <co...@gmail.com> wrote:
> "auto"? Then e.g. proxy_ws can check for auto && Upgrade header.
I'm fine with "auto" too ( since I definitively like C++11 :p ).
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Eric Covener <co...@gmail.com>.
On Wed, Jun 11, 2014 at 9:25 AM, Yann Ylavic <yl...@gmail.com> wrote:
> I prefer 'passthru' then.
"auto"? Then e.g. proxy_ws can check for auto && Upgrade header.
--
Eric Covener
covener@gmail.com
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Yann Ylavic <yl...@gmail.com>.
Oh yes, good point!
I prefer 'passthru' then.
On Wed, Jun 11, 2014 at 3:22 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> The reason I didn't use proxy is that we use 'proxy' internally
> and we now expose that via allowing its use as a handler...
>
> On Jun 11, 2014, at 9:09 AM, Yann Ylavic <yl...@gmail.com> wrote:
>
>> On Wed, Jun 11, 2014 at 2:51 PM, Jim Jagielski <ji...@jagunet.com> wrote:
>>> So how about 'passthru' as the special scheme? Or
>>> maybe just 'pass', 'scheme' or even 'glob' ??
>>
>> Simply 'proxy'? Which would not be filenamed to "proxy:proxy:" but to
>> "proxy:${ap_http_scheme(r)}:"?
>> Otherwise, +1 for 'passthru'.
>>
>
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
The reason I didn't use proxy is that we use 'proxy' internally
and we now expose that via allowing its use as a handler...
On Jun 11, 2014, at 9:09 AM, Yann Ylavic <yl...@gmail.com> wrote:
> On Wed, Jun 11, 2014 at 2:51 PM, Jim Jagielski <ji...@jagunet.com> wrote:
>> So how about 'passthru' as the special scheme? Or
>> maybe just 'pass', 'scheme' or even 'glob' ??
>
> Simply 'proxy'? Which would not be filenamed to "proxy:proxy:" but to
> "proxy:${ap_http_scheme(r)}:"?
> Otherwise, +1 for 'passthru'.
>
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Jun 11, 2014 at 2:51 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> So how about 'passthru' as the special scheme? Or
> maybe just 'pass', 'scheme' or even 'glob' ??
Simply 'proxy'? Which would not be filenamed to "proxy:proxy:" but to
"proxy:${ap_http_scheme(r)}:"?
Otherwise, +1 for 'passthru'.
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
I have an idea which could be pretty simple to
implement and not add yet-another ProxyPass parameter.
A special scheme.
Ideally, something like
ProxyPass / *://foo.example.com/
would be nice, with the special scheme '*' saying
"use the scheme of the request", but apr_uri_parse
barfs on that.
So how about 'passthru' as the special scheme? Or
maybe just 'pass', 'scheme' or even 'glob' ??
On May 31, 2014, at 11:53 AM, Jim Jagielski <ji...@jaguNET.com> wrote:
> I'm sure we can do w/ mod_rewrite... it's just that
> it's soo expensive :)
>
> On May 30, 2014, at 3:40 PM, Ruediger Pluem <rp...@apache.org> wrote:
>
>>
>>
>> Jim Jagielski wrote:
>>> Off the top of my head, I think we would need to
>>> add another proxypass option.
>>
>> Have you tried the following?
>>
>> RewriteEngine On
>> RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
>> RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
>> RewriteRule ^/(.*) http://my.backend:8080/$1 [P]
>>
>>
>>
>> Regards
>>
>> Rüdiger
>>
>
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
I'm sure we can do w/ mod_rewrite... it's just that
it's soo expensive :)
On May 30, 2014, at 3:40 PM, Ruediger Pluem <rp...@apache.org> wrote:
>
>
> Jim Jagielski wrote:
>> Off the top of my head, I think we would need to
>> add another proxypass option.
>
> Have you tried the following?
>
> RewriteEngine On
> RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
> RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
> RewriteRule ^/(.*) http://my.backend:8080/$1 [P]
>
>
>
> Regards
>
> Rüdiger
>
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
I'm sure we can do w/ mod_rewrite... it's just that
it's soo expensive :)
On May 30, 2014, at 3:40 PM, Ruediger Pluem <rp...@apache.org> wrote:
>
>
> Jim Jagielski wrote:
>> Off the top of my head, I think we would need to
>> add another proxypass option.
>
> Have you tried the following?
>
> RewriteEngine On
> RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
> RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
> RewriteRule ^/(.*) http://my.backend:8080/$1 [P]
>
>
>
> Regards
>
> Rüdiger
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Ruediger Pluem <rp...@apache.org>.
Jim Jagielski wrote:
> Off the top of my head, I think we would need to
> add another proxypass option.
Have you tried the following?
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV]
RewriteRule ^/(.*) ws://my.backend:8080/$1 [P]
RewriteRule ^/(.*) http://my.backend:8080/$1 [P]
Regards
Rüdiger
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
Off the top of my head, I think we would need to
add another proxypass option.
On May 30, 2014, at 10:21 AM, Maxim Solodovnik <so...@gmail.com> wrote:
> I also would like to know :)
> Is it also possible using Apache 2.4.7?
>
>
> On Fri, May 30, 2014 at 9:08 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> Hmmm... let me mull this over.
>
> BTW: CCing on dev@
> On May 29, 2014, at 11:18 AM, Juan Ignacio Barisich <ju...@gmail.com> wrote:
>
> > I need to configure in Apache 2.4.9 (with mod_proxy and mod_proxy_wstunnel activated) a proxy with this mapping:
> >
> > - http://my.proxy/* --> http://my.backend:8080/*
> > - ws://my.proxy/* --> ws://my.backend:8080/*
> >
> > E.g.:
> >
> > - ws://my.proxy/cometd-demo-2.8.0/cometd --> ws://my.backend:8080/cometd-demo-2.8.0/cometd
> > - http://my.proxy/cometd-demo-2.8.0/cometd --> http://my.backend:8080/cometd-demo-2.8.0/cometd
> > - http://my.proxy/cometd-demo-2.8.0/jquery-examples/chat/ --> http://my.backend:8080/cometd-demo-2.8.0/jquery-examples/chat/
> >
> > In other words, I need a proxy that keeps (preserves) the protocol.
> >
> > This configuration does not work:
> >
> > <VirtualHost *:80>
> > ...
> > ProxyRequests Off
> > ProxyPreserveHost Off
> > ProxyPass / http://my.backend:8080/
> > ProxyPassReverse / http://my.backend:8080/
> > </VirtualHost>
> > because all request (no matter protocol) are proxied to http*
> >
> > Anyone knows how can I solve this?
> >
> > Thanks!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
>
> --
> WBR
> Maxim aka solomax
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
Off the top of my head, I think we would need to
add another proxypass option.
On May 30, 2014, at 10:21 AM, Maxim Solodovnik <so...@gmail.com> wrote:
> I also would like to know :)
> Is it also possible using Apache 2.4.7?
>
>
> On Fri, May 30, 2014 at 9:08 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> Hmmm... let me mull this over.
>
> BTW: CCing on dev@
> On May 29, 2014, at 11:18 AM, Juan Ignacio Barisich <ju...@gmail.com> wrote:
>
> > I need to configure in Apache 2.4.9 (with mod_proxy and mod_proxy_wstunnel activated) a proxy with this mapping:
> >
> > - http://my.proxy/* --> http://my.backend:8080/*
> > - ws://my.proxy/* --> ws://my.backend:8080/*
> >
> > E.g.:
> >
> > - ws://my.proxy/cometd-demo-2.8.0/cometd --> ws://my.backend:8080/cometd-demo-2.8.0/cometd
> > - http://my.proxy/cometd-demo-2.8.0/cometd --> http://my.backend:8080/cometd-demo-2.8.0/cometd
> > - http://my.proxy/cometd-demo-2.8.0/jquery-examples/chat/ --> http://my.backend:8080/cometd-demo-2.8.0/jquery-examples/chat/
> >
> > In other words, I need a proxy that keeps (preserves) the protocol.
> >
> > This configuration does not work:
> >
> > <VirtualHost *:80>
> > ...
> > ProxyRequests Off
> > ProxyPreserveHost Off
> > ProxyPass / http://my.backend:8080/
> > ProxyPassReverse / http://my.backend:8080/
> > </VirtualHost>
> > because all request (no matter protocol) are proxied to http*
> >
> > Anyone knows how can I solve this?
> >
> > Thanks!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
>
> --
> WBR
> Maxim aka solomax
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by Maxim Solodovnik <so...@gmail.com>.
I also would like to know :)
Is it also possible using Apache 2.4.7?
On Fri, May 30, 2014 at 9:08 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> Hmmm... let me mull this over.
>
> BTW: CCing on dev@
> On May 29, 2014, at 11:18 AM, Juan Ignacio Barisich <
> juan.barisich@gmail.com> wrote:
>
> > I need to configure in Apache 2.4.9 (with mod_proxy and
> mod_proxy_wstunnel activated) a proxy with this mapping:
> >
> > - http://my.proxy/* --> http://my.backend:8080/*
> > - ws://my.proxy/* --> ws://my.backend:8080/*
> >
> > E.g.:
> >
> > - ws://my.proxy/cometd-demo-2.8.0/cometd -->
> ws://my.backend:8080/cometd-demo-2.8.0/cometd
> > - http://my.proxy/cometd-demo-2.8.0/cometd -->
> http://my.backend:8080/cometd-demo-2.8.0/cometd
> > - http://my.proxy/cometd-demo-2.8.0/jquery-examples/chat/ -->
> http://my.backend:8080/cometd-demo-2.8.0/jquery-examples/chat/
> >
> > In other words, I need a proxy that keeps (preserves) the protocol.
> >
> > This configuration does not work:
> >
> > <VirtualHost *:80>
> > ...
> > ProxyRequests Off
> > ProxyPreserveHost Off
> > ProxyPass / http://my.backend:8080/
> > ProxyPassReverse / http://my.backend:8080/
> > </VirtualHost>
> > because all request (no matter protocol) are proxied to http*
> >
> > Anyone knows how can I solve this?
> >
> > Thanks!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
--
WBR
Maxim aka solomax
Re: [users@httpd] Preserve protocol in httpd proxy
Posted by bara bere <ba...@gmail.com>.
thank
2014-05-30 22:08 GMT+08:00, Jim Jagielski <ji...@jagunet.com>:
> Hmmm... let me mull this over.
>
> BTW: CCing on dev@
> On May 29, 2014, at 11:18 AM, Juan Ignacio Barisich
> <ju...@gmail.com> wrote:
>
>> I need to configure in Apache 2.4.9 (with mod_proxy and mod_proxy_wstunnel
>> activated) a proxy with this mapping:
>>
>> - http://my.proxy/* --> http://my.backend:8080/*
>> - ws://my.proxy/* --> ws://my.backend:8080/*
>>
>> E.g.:
>>
>> - ws://my.proxy/cometd-demo-2.8.0/cometd -->
>> ws://my.backend:8080/cometd-demo-2.8.0/cometd
>> - http://my.proxy/cometd-demo-2.8.0/cometd -->
>> http://my.backend:8080/cometd-demo-2.8.0/cometd
>> - http://my.proxy/cometd-demo-2.8.0/jquery-examples/chat/ -->
>> http://my.backend:8080/cometd-demo-2.8.0/jquery-examples/chat/
>>
>> In other words, I need a proxy that keeps (preserves) the protocol.
>>
>> This configuration does not work:
>>
>> <VirtualHost *:80>
>> ...
>> ProxyRequests Off
>> ProxyPreserveHost Off
>> ProxyPass / http://my.backend:8080/
>> ProxyPassReverse / http://my.backend:8080/
>> </VirtualHost>
>> because all request (no matter protocol) are proxied to http*
>>
>> Anyone knows how can I solve this?
>>
>> Thanks!
>
>