proxying of POST requests based on $args not working
M. G.
techgarry75 at yahoo.com
Fri May 9 06:49:55 UTC 2014
Hi,
The proxying of GET requests on $args i.e. feedid=293634 goes to server2 properly.
But proxying of POST requests on $args i.e. feedid=293634 always goes to server1 instead of server2.
Following is configuration...
1. /etc/nginx/nginx.conf contains
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/proxy.conf;
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 64;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 70;
include /tmp/routing.conf ;
}
2. /etc/nginx/proxy.conf contains
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
client_body_buffer_size 100m;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_buffers 32 4k;
proxy_next_upstream error timeout http_500 http_502 http_503 http_504 http_404 invalid_header;
log_format postdata $request_body;
3. /tmp/routing.conf contains
upstream server1 {
server 192.168.20.202:8090;
}
upstream server2 {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name mysubdomain.domain.co.in;
location / {
proxy_pass http://server1;
if ( $args ~ 'feedid=293634' ) {
proxy_pass http://server2;
}
if ( $request_method = POST ) {
set $test P;
}
if ( $args ~ 'feedid=293634' ) {
set $test "${test}C";
}
if ( $test = PC) {
proxy_pass http://server2;
}
}
}
Any suggestions....
Thanks,
M. G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140508/3a3ddd0a/attachment.html>
More information about the nginx
mailing list