# POST Requests and Proxy Behavior

**URL:** <https://www.ruby-forum.com/t/post-requests-and-proxy-behavior/184106>\
**Category:** NGINX\
**Created:** [February 25, 2010, 5:41am UTC](https://www.ruby-forum.com/t/post-requests-and-proxy-behavior/184106 "2010-02-25T05:41:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_Madsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecb155/32.png) [@Andy\_Madsen](https://www.ruby-forum.com/u/Andy_Madsen)\
**Post date:** [February 25, 2010, 5:41am UTC](https://www.ruby-forum.com/t/post-requests-and-proxy-behavior/184106/1 "2010-02-25T05:41:04Z")

</div>

Hi Everyone:

I have a two webservers running nginx behind a load balancer. These two  
webservers are proxying SSL content from an app server on the LAN  
address that is not on the load balancer. Configuration is below:

==================================================  
server {  
listen 443;  
server\_name [some.domain.com](http://some.domain.com);

ssl on;  
ssl\_certificate /path/to/some\_cert.pem;  
ssl\_certificate\_key /path/to/some\_key.pem;

access\_log /var/log/httpd/nginx\_ssl\_access\_log main;  
#access\_log off;  
error\_log /var/log/httpd/nginx\_ssl\_error\_log;

charset utf-8;

location / {

if (-f $request\_filename) {  
expires max;  
break;  
}

if ($request\_filename !~ “.(js|htc|ico|gif|jpg|png|css)$”) {  
proxy\_pass [https://192.168.2.1](https://192.168.2.1);  
}

}

# }

This works very well for all GET requests, but if I try to post from a  
non-ssl machine to the load balancer, the proxy tries to serve a file  
using the LAN address, and obviously fails at [https://192.168.2.1](https://192.168.2.1). Is  
there something I’m missing in the reverse proxy for a POST request in  
my configuration? I haven’t been able to find any specific documentation  
about why a POST wouldn’t work, and GET would.

NGINX is great!

Thanks  
Andy

---

<div class="post-metadata">

**Author:** ![Andy\_Madsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecb155/32.png) [@Andy\_Madsen](https://www.ruby-forum.com/u/Andy_Madsen)\
**Post date:** [February 26, 2010, 4:02am UTC](https://www.ruby-forum.com/t/post-requests-and-proxy-behavior/184106/2 "2010-02-26T04:02:39Z")

</div>

Hi Andy,

It looks like a problem I have with my reverse proxy setup.  
I was able to correct it by setting the Host HTTP header to the proxy  
request with “proxy\_set\_header Host $http\_host;” just before proxy\_pass.

Hope this helps!  
GFK’s

Andy Madsen a écrit :

---

<div class="post-metadata">

**Author:** ![Andy\_Madsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecb155/32.png) [@Andy\_Madsen](https://www.ruby-forum.com/u/Andy_Madsen)\
**Post date:** [March 1, 2010, 9:50pm UTC](https://www.ruby-forum.com/t/post-requests-and-proxy-behavior/184106/3 "2010-03-01T21:50:29Z")

</div>

Merci Guillaume, parfait!

Works like a charm. Was worried for just a second 😉 Trust the NGIN,  
always trust the NGIN.

Andy
