Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 6530:1d0e03db9f8e
Upstream: the "transparent" parameter of proxy_bind and friends.
This parameter lets binding the proxy connection to a non-local address.
Upstream will see the connection as coming from that address.
When used with $remote_addr, upstream will accept the connection from real
client address.
Example:
proxy_bind $remote_addr transparent;
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 18 Dec 2015 19:05:27 +0300 |
parents | 88f012eee7d8 |
children | f7849bfb6d21 |
comparison
equal
deleted
inserted
replaced
6529:cb8177ca0990 | 6530:1d0e03db9f8e |
---|---|
5786 return "is duplicate"; | 5786 return "is duplicate"; |
5787 } | 5787 } |
5788 | 5788 |
5789 value = cf->args->elts; | 5789 value = cf->args->elts; |
5790 | 5790 |
5791 if (ngx_strcmp(value[1].data, "off") == 0) { | 5791 if (cf->args->nelts == 2 && ngx_strcmp(value[1].data, "off") == 0) { |
5792 *plocal = NULL; | 5792 *plocal = NULL; |
5793 return NGX_CONF_OK; | 5793 return NGX_CONF_OK; |
5794 } | 5794 } |
5795 | 5795 |
5796 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); | 5796 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
5839 default: | 5839 default: |
5840 return NGX_CONF_ERROR; | 5840 return NGX_CONF_ERROR; |
5841 } | 5841 } |
5842 } | 5842 } |
5843 | 5843 |
5844 if (cf->args->nelts > 2) { | |
5845 if (ngx_strcmp(value[2].data, "transparent") == 0) { | |
5846 #if (NGX_HAVE_TRANSPARENT_PROXY) | |
5847 local->transparent = 1; | |
5848 #else | |
5849 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
5850 "transparent proxying is not supported " | |
5851 "on this platform, ignored"); | |
5852 #endif | |
5853 } else { | |
5854 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
5855 "invalid parameter \"%V\"", &value[2]); | |
5856 return NGX_CONF_ERROR; | |
5857 } | |
5858 } | |
5859 | |
5844 return NGX_CONF_OK; | 5860 return NGX_CONF_OK; |
5845 } | 5861 } |
5846 | 5862 |
5847 | 5863 |
5848 static ngx_int_t | 5864 static ngx_int_t |
5855 | 5871 |
5856 if (local == NULL) { | 5872 if (local == NULL) { |
5857 u->peer.local = NULL; | 5873 u->peer.local = NULL; |
5858 return NGX_OK; | 5874 return NGX_OK; |
5859 } | 5875 } |
5876 | |
5877 #if (NGX_HAVE_TRANSPARENT_PROXY) | |
5878 u->peer.transparent = local->transparent; | |
5879 #endif | |
5860 | 5880 |
5861 if (local->value == NULL) { | 5881 if (local->value == NULL) { |
5862 u->peer.local = local->addr; | 5882 u->peer.local = local->addr; |
5863 return NGX_OK; | 5883 return NGX_OK; |
5864 } | 5884 } |