Problem :
Sometimes you may have experienced that the custom header values defined and sent through client has been dropped off when it goes via the nginx in a setup fronted by nginx.
Solution :
1. First you should check whether the custom headers contain underscores (_)
2. If so you need to check whether you have configured underscores_in_headers in your nginx.conf under each server.
3. By default, underscores_in_headers is off.
4. Therefore you need to configure it to on.
Reason :
By this property,
It enables or disables the use of underscores in client request header fields. When the use of underscores is disabled, request header fields whose names contain underscores are marked as invalid and become subject to the ignore_invalid_headers directive.
Ref: http://nginx.org/en/docs /http/ngx_http_core_module.html
Example :
Sample configuration would be as below :
server{
listen 8280;
server_name wrk.esb.com;
underscores_in_headers on;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;.
.
.
.
.
}
}
Showing posts with label nginx. Show all posts
Showing posts with label nginx. Show all posts
Monday, February 16, 2015
Wednesday, February 11, 2015
Reason and solution for not loading WSDL in a clustered setup fronted by NGINX
For more information about nginx http proxy module please refer : http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version | |
Issue : Sometimes a WSDL in a clustered setup fronted by NGINX might not be loaded. |
By default, http version 1.0 is used in nginx. Version 1.1 is recommended for use with keepalive connections. Therefore sometimes the wsdl will not be loaded.
You can confirm it by doing a curl command to the wsdl ngingx url.
E.g., curl http://wrk.test.com:8280/services/test?wsdl
Then you will get half of the wsdl.
Solution :
To avoid this, you will have to configure the nginx configuration file to set it's http version.
proxy_http_version 1.1;
Example :
As an example,
server{
listen 8280;
server_name wrk.test.com;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_pass http://esbworkers;
proxy_redirect http://esbworkers http://wrk.esb.com:8280/;
}
}
This configuration is applicable for nginx versions above 1.1.4
Subscribe to:
Posts (Atom)