Open sydcurie opened 14 years ago
Try
eval_override_content_type text/plain; default_type text/html; eval $resp { proxy_pass http://127.0.0.1:81$request_uri; proxy_method GET; proxy_pass_request_body off; }
Seems to be resolved, I'm closing it.
Hi guys,
Did you manage to make it working ?
I'm working with nginx 1.2.1 and here is my vhost config:
upstream test {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name domain.tld;
location / {
#eval_override_content_type text/plain;
#default_type text/html;
eval $resp {
proxy_pass http://test;
#proxy_method GET;
#proxy_pass_request_body on;
}
echo "test, $request_body";
access_log /var/log/nginx/nginx.log custom;
}
}
I tried with the solution you proposed but I need to keep the request method as it is. My need is to intercept each request (GET or POST) sent to nginx and ask a remote server for some informations to determine the upstream to use.
I would greatly appreciate your help.
Rémi
In your case uncommenting "proxy_pass_request_body on" should help.
Hi,
Thanks for your reply.
With this vhost, I still see GET requests on my upstream when I post something:
upstream test {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name domain.tld;
location / {
eval $resp {
proxy_pass http://test;
proxy_pass_request_body on;
}
echo "test, $resp";
access_log /var/log/nginx/nginx.log custom;
}
}
Any idea ?
Rémi
OK doesn't matter. I used perl embedded module which corresponds better to what I wanted to do.
@darkweaver87 Which perl module did you use ?
I configured eval-module working with proxy_pass (tomcat,apache), when the request method is "GET" it works well.But when I "POST" a request to nginx , it turned into "GET"(saw it from apache's access_log). I have no idea how to fix this. This is my nginx.conf:
location / { eval_override_content_type text/plain; default_type text/html; eval $resp { proxy_pass http://127.0.0.1:81$request_uri; } echo "test, $resp"; }