Hello Maxim, OK got it now ;-) It's working, you saved my day :-D So to put it in a nutshell: - I used perl switcher_test::handler in my location / - in the handler method I call $r->has_request_body(\& test) and in test method according to what I found in the body I do an internal_redirect (as far as I understood it can only redirect to a location in the same vhost) to /proxy1 (orby darkweaver871 - Nginx Mailing List - English
OK, so is this better ? #!/usr/bin/perl package switcher_test; use nginx; use Sys::Syslog; my $facility = 'local2'; sub handler { my $r = shift; return $r->has_request_body(\& test); } sub test { my $r = shift; if ($r->request_body =~ /.*test.*/) { return 3 }; openlog('switcher', 'ndelay', $facility); syslog(LOby darkweaver871 - Nginx Mailing List - English
"and I'm not sure it was clear enough for you" - I meant my post wasn't clear enoughby darkweaver871 - Nginx Mailing List - English
Hi Maxim, Thanks for your reply. I don't understand what you mean by "content handler" as I'm a noob in nginx perl usage (and I'm not sure it was clear enough for you). I tested http_content_length but it's empty also. I really need to have the calling request body (I deleted the major part of my code but I parse some stuff in). Let's say I want to return 3 to perl_set if the rby darkweaver871 - Nginx Mailing List - English
It can be reproduced by commenting/uncommenting the append in the following code: #!/usr/bin/python # -*- coding: utf-8 -*- import urllib import urllib2 url = 'https://www.test.com/test.php' params = { 'name': 'Luke', 'location': 'Tatooine' } pList = [] for paramKey, paramValue in params.items(): pList.append(urllib.quote_plus(unicode('%s=%s' % (paramKey, paramValue)))) #by darkweaver871 - Nginx Mailing List - English
I forgot to mention. I'm using the following nginx version: # nginx -vV nginx version: nginx/1.2.1 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-teby darkweaver871 - Nginx Mailing List - English
Hi all, I'm using Nginx as a reverse proxy and I use Nginx perl module to inspect my requests and redirect to a different upstream. It works well but some of request_body are empty and others just make nginx timeout. Here is my nginx.conf: user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basicby darkweaver871 - Nginx Mailing List - English