POST Requests and Proxy Behavior

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;

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

}

}

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. 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

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 :

Merci Guillaume, parfait!

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

Andy