How to proxy_pass POST with headers

Jaakko Pasanen jkpasanen at gmail.com
Fri Jan 27 21:13:12 UTC 2012


António P. P. Almeida kirjoitti 27.1.2012 kello 16.12:

> For starters: http://wiki.nginx.org/IfIsEvil

This actually solved my problem!

I changed the if statement to:

if ($request_method = POST)
        {
            return 418;
        } 

and added:

error_page 418 = @post;

location @post {
         proxy_pass http://foo.bar:8085;
         proxy_set_header Host $http_host;
         proxy_set_header X-Forwarded-Host $http_host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

Now it works flawlessly!

Thanks!

---

Jaakko Pasanen


More information about the nginx mailing list