Welcome! Log In Create A New Profile

Advanced

proxying of POST requests based on $args not working

May 09, 2014 02:52AM
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.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxying of POST requests based on $args not working

techgarry75 May 09, 2014 02:52AM

Re: proxying of POST requests based on $args not working

Maxim Dounin May 09, 2014 03:08AM

Re: proxying of POST requests based on $args not working

techgarry75 May 09, 2014 03:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 243
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready