Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eval-module did not work with proxy_pass when request method is not GET #4

Open
sydcurie opened this issue Aug 22, 2010 · 7 comments
Open

Comments

@sydcurie
Copy link

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";
}

@vkholodkov
Copy link
Owner

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;
}

@vkholodkov
Copy link
Owner

Seems to be resolved, I'm closing it.

@darkweaver87
Copy link

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

@vkholodkov
Copy link
Owner

In your case uncommenting "proxy_pass_request_body on" should help.

@darkweaver87
Copy link

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

@darkweaver87
Copy link

OK doesn't matter. I used perl embedded module which corresponds better to what I wanted to do.

@akshit24
Copy link

@darkweaver87 Which perl module did you use ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants