httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gruno <humbed...@apache.org>
Subject Re: [users@httpd] Refiring requests to proxy backend
Date Fri, 18 Dec 2015 16:12:34 GMT
I think you need two phases here, as mod_lua doesn't itself do the
proxying, but delegates it to mod_proxy.

First, http://modlua.org/recipes/loadbalancing will show you how to proxy.

Secondly, you could then set up a handler for the specific HTTP code
using ErrorDocument or an output filter.

I haven't tried this myself (the 'act on return code'), but it should work.

With regards,
Daniel.

On 12/18/2015 04:23 PM, Jim Jagielski wrote:
> I'm not a mod_lua expert, esp as it relates to exposing the
> full Apache httpd API... it is possible that using r.handler
> and specifying the proxy may work.
> 
>> On Dec 18, 2015, at 8:05 AM, Jose Thomas <jostho@gmail.com> wrote:
>>
>> Jim,
>>
>> Sorry, I could not find the documentation on how to do this using mod_lua. Can you
please point me there ? 
>>
>> In my current setup which is on httpd 2.2 - we use modpython. For routing requests
(based on a header) we use a simple python script. For refiring the request (when a custom
response code is received), another python script is configured in a "PythonOutputFilter".
That script internally uses the python requests library. 
>>
>> We are upgrading to httpd 2.4 and wanted to see if this code can be ported to mod_lua.
I have already ported the first script (routing) to lua. Where i am clueless, is how to resend
the request to backend for the 2nd script in a "LuaOutputFilter".
>>
>> Thanks & regards,
>> Jose
>>
>> On Fri, Dec 18, 2015 at 5:08 PM, Jim Jagielski <jim@jagunet.com> wrote:
>> In general, if you prepend the URL w/ 'proxy:' and then
>> use it in a subrequest, it will be processed as a proxy
>> request.
>>> On Dec 17, 2015, at 9:21 AM, Jose Thomas <jostho@gmail.com> wrote:
>>>
>>> All,
>>>
>>> I am using httpd 2.4 with mod_proxy (http) routing requests to multiple backends.
>>>
>>> I have a strange requirement. If a backend responds with a custom response code
- i need to re-execute the request to a different backend.
>>>
>>> What would be the right way to implement this functionality ?
>>>
>>> I was looking at mod_lua for a solution. The idea is to use a "LuaOutputFilter"
to check the response code, and then re-execute the request with a different backend. How
can i refire the request ? Should i use a lua httpclient library for this ? Is there a easier
way to do this ?
>>>
>>> Any other suggestions/comments are welcome.
>>>
>>> Version of stack
>>> * Apache 2.4.6
>>> * Lua 5.1.4
>>>
>>> Regards,
>>> Jose
>>> ____________
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message