You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Daniel Gruno <ru...@cord.dk> on 2014/06/01 08:22:38 UTC

Re: [users@httpd] Preserve protocol in httpd proxy

...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