Re: Modify request body before sending to upstream

2015-01-26 Thread abhinanda
Nevermind my previous post. I solved it finally :) location /foo { rewrite_by_lua ' res = ngx.location.capture("/bar", {method = ngx.HTTP_POST, body = "jjj"}) res = ngx.location.capture("/bar", {method = ngx.HTTP_POST, body = res.body}) ngx.print(re

Re: Modify request body before sending to upstream

2015-01-26 Thread abhinanda
Still no luck. Here's my config: upstream wservers { server localhost:8001 max_fails=3 fail_timeout=2s weight=100; server localhost:8002 max_fails=3 fail_timeout=2s weight=100; } server { location /foo { rewrite_by_lua ' ngx.print("yay") '; proxy_pa

Re: Modify request body before sending to upstream

2015-01-26 Thread mex
Hi, > I tried ngx_lua but I might've been doing something wrong. It > complained that I am not allowed to use "proxy_pass" following a > content rewrite. you should read the documentatrion carefully: http://wiki.nginx.org/HttpLuaModule#content_by_lua "Do not use this directive and other conte

Re: Modify request body before sending to upstream

2015-01-26 Thread abhinanda
Thanks! I tried ngx_lua but I might've been doing something wrong. It complained that I am not allowed to use "proxy_pass" following a content rewrite. To make it even simpler, here's a simplified example: - curl -X POST --data "ABCD" localhost:8080 - an NGINX module that calls a custom C functi

Re: Modify request body before sending to upstream

2015-01-26 Thread mex
Hi Abhishek, i'm not 100% sure to understand exactrly what you'd like to do, especially the request-body-manipulation-part. nginx_lua is usually quite handy when you have the need to manipulate a request: http://wiki.nginx.org/HttpLuaModule#access_by_lua you can jump into the acces- or rewrite-

Re: Modify request body before sending to upstream

2015-01-26 Thread abhinanda
Hi, Any info on this? I've been trying a ton of ways to achieve this but it seems like I'm really lost. To repeat with clarity, I need to operate on the request body first, modify it and THEN send it off to upstream servers with the modified content. Any pointers must help. Please :) Abhishek

Modify request body before sending to upstream

2015-01-21 Thread abhinanda
Hi, I am new to nginx module development and I'm working on my first ever module. I've read up Evan Miller's post besides others, and I've experimented tweaking some simple modules. >From what I understand, proxy_pass module is a handler and we can effectively have just one handler run on a reque