Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want my server proxy Google if my $request_body of a POSTed request contains the string google, e.g.

echo "google" | lwp-request -m POST "http://127.0.0.1"

So I have the config like, e.g.

server {
  listen 127.0.0.1:80 default;

  location / {
        if ($request_body ~* .*google.*) {
            proxy_pass http://www.google.com;
            break;
        }
    }
}

But the result of the above config is always "404 Not Found"

Any idea? Thanks.

share|improve this question
    
Are you sure it is your nginx that returns the 404, and not the proxied request? –  pkhamre Sep 17 '12 at 13:13
    
@pkhamre, the 404 is returned from nginx, I can see the at the footer <hr><center>nginx/1.1.19</center> –  Ryan Sep 17 '12 at 14:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.