httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gruno <rum...@cord.dk>
Subject Re: [users@httpd] Preserve protocol in httpd proxy
Date Sun, 01 Jun 2014 06:22:38 GMT
...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 <rpluem@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


Mime
View raw message