summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules/ngx_http_proxy_module.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-09-12Upstream: limited next_upstream time and tries (ticket #544).Roman Arutyunyan1-0/+22
The new directives {proxy,fastcgi,scgi,uwsgi,memcached}_next_upstream_tries and {proxy,fastcgi,scgi,uwsgi,memcached}_next_upstream_timeout limit the number of upstreams tried and the maximum time spent for these tries when searching for a valid upstream.
2014-06-26Upstream: cache revalidation using If-None-Match.Maxim Dounin1-1/+1
2014-05-14Style: use %N instead of '\n' where appropriate.Ruslan Ermilov1-1/+1
2013-11-18Proxy: fixed possible uninitialized memory access.Valentin Bartenev1-3/+3
The ngx_http_proxy_rewrite_cookie() function expects the value of the "Set-Cookie" header to be null-terminated, and for headers obtained from proxied server it is usually true. Now the ngx_http_proxy_rewrite() function preserves the null character while rewriting headers. This fixes accessing memory outside of rewritten value if both the "proxy_cookie_path" and "proxy_cookie_domain" directives are used in the same location.
2014-04-18Upstream: proxy_ssl_verify and friends.Maxim Dounin1-0/+62
2014-04-18Upstream: proxy_ssl_name and proxy_ssl_server_name directives.Maxim Dounin1-0/+26
These directives allow to switch on Server Name Indication (SNI) while connecting to upstream servers. By default, proxy_ssl_server_name is currently off (that is, no SNI) and proxy_ssl_name is set to a host used in the proxy_pass directive.
2014-04-18Upstream: plugged potential memory leak on reload.Maxim Dounin1-8/+8
The SSL_CTX_set_cipher_list() may fail if there are no valid ciphers specified in proxy_ssl_ciphers / uwsgi_ssl_ciphers, resulting in SSL context leak. In theory, ngx_pool_cleanup_add() may fail too, but this case is intentionally left out for now as it's almost impossible and proper fix will require changes to http ssl and mail ssl code as well.
2014-02-11Upstream: fix $upstream_status variable.Piotr Sikora1-1/+1
Previously, upstream's status code was overwritten with cached response's status code when STALE or REVALIDATED response was sent to the client. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2013-12-11Use ngx_chain_get_free_buf() in pipe input filters.Valentin Bartenev1-38/+10
No functional changes.
2013-11-18Upstream: cache revalidation with conditional requests.Maxim Dounin1-1/+13
The following new directives are introduced: proxy_cache_revalidate, fastcgi_cache_revalidate, scgi_cache_revalidate, uwsgi_cache_revalidate. Default is off. When set to on, they enable cache revalidation using conditional requests with If-Modified-Since for expired cache items. As of now, no attempts are made to merge headers given in a 304 response during cache revalidation with headers previously stored in a cache item. Headers in a 304 response are only used to calculate new validity time of a cache item.
2013-09-27Upstream: proxy_no_cache, fastcgi_no_cache warnings removed.Maxim Dounin1-6/+0
2013-09-23Proxy: added the "proxy_ssl_ciphers" directive.Piotr Sikora1-0/+22
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2013-09-19Proxy: added the "proxy_ssl_protocols" directive.Andrei Belov1-10/+40
2013-09-04Win32: Borland C compatibility fixes.Maxim Dounin1-2/+2
Several false positive warnings silenced, notably W8012 "Comparing signed and unsigned" (due to u_short values promoted to int), and W8072 "Suspicious pointer arithmetic" (due to large type values added to pointers). With this patch, it's now again possible to compile nginx using bcc32, with options we normally compile on win32 minus ipv6 and ssl.
2013-07-25Upstream: added check if a response is complete.Maxim Dounin1-1/+1
Checks were added to both buffered and unbuffered code paths to detect and complain if a response is incomplete. Appropriate error codes are now passed to ngx_http_upstream_finalize_request(). With this change in unbuffered mode we now use u->length set to -1 as an indicator that EOF is allowed per protocol and used to indicate response end (much like its with p->length in buffered mode). Proxy module was changed to set u->length to 1 (instead of previously used -1) in case of chunked transfer encoding used to comply with the above.
2013-05-27Upstream: http_403 support in proxy_next_upstream (and friends).Maxim Dounin1-0/+1
The parameter is mostly identical to http_404, and is expected to be used in similar situations. The 403 code might be returned by a backend instead of 404 on initial sync of new directories with rsync. See here for feature request and additional details: http://mailman.nginx.org/pipermail/nginx-ru/2013-April/050920.html
2013-05-15Proxy: clear script engine used to calculate lengths.Maxim Dounin1-0/+2
Previous code is believed to be safe, but might access uninitialized memory (e.g., e->quote).
2013-05-11Proxy: $proxy_internal_body_length fixed.Maxim Dounin1-1/+2
The $proxy_internal_body_length value might change during request lifetime, notably if proxy_set_body used, and use of a cached value might result in incorrect upstream requests. Patch by Lanshun Zhou.
2013-04-29Proxy: allocate $proxy_internal_body_length from request pool.Ruslan Ermilov1-1/+1
2013-02-27Correctly handle multiple X-Forwarded-For headers (ticket #106).Ruslan Ermilov1-9/+21
2013-02-18Proxy: support for connection upgrade (101 Switching Protocols).Maxim Dounin1-0/+8
This allows to proxy WebSockets by using configuration like this: location /chat/ { proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } Connection upgrade is allowed as long as it was requested by a client via the Upgrade request header.
2013-01-22Proxy: fixed proxy_method to always add space.Maxim Dounin1-4/+5
Before the patch if proxy_method was specified at http{} level the code to add trailing space wasn't executed, resulting in incorrect requests to upstream.
2013-01-16Fixed and improved the "*_bind" directives of proxying modules.Ruslan Ermilov1-0/+5
The "proxy_bind", "fastcgi_bind", "uwsgi_bind", "scgi_bind" and "memcached_bind" directives are now inherited; inherited value can be reset by the "off" parameter. Duplicate directives are now detected. Parameter value can now contain variables.
2012-12-13Proxy: better error message about unexpected data.Maxim Dounin1-1/+2
Requested by Igor Sysoev.
2012-12-06Allow the complex value to be defined as an empty string.Ruslan Ermilov1-2/+2
This makes conversion from strings to complex values possible without the loss of functionality.
2012-11-21Request body: always use calculated size of a request body in proxy.Maxim Dounin1-16/+11
This allows to handle requests with chunked body, and also simplifies handling of various request body modifications.
2012-11-21Request body: chunked parsing moved to ngx_http_parse.c from proxy.Maxim Dounin1-276/+14
No functional changes.
2012-04-23Proxy: added ctx checking to input filters.Maxim Dounin1-0/+18
The proxy module context may be NULL in case of filter finalization (e.g. by image_filter) followed by an internal redirect. This needs some better handling, but for now just check if ctx is still here.
2012-04-12Fixed grammar in error messages.Ruslan Ermilov1-11/+11
2012-03-15Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().Maxim Dounin1-2/+4
This resulted in a disclosure of previously freed memory if upstream server returned specially crafted response, potentially exposing sensitive information. Reported by Matthew Daley.
2012-02-28Fixed spelling in single-line comments.Ruslan Ermilov1-2/+2
2012-02-13Proxy: added the "proxy_cookie_path" directive.Valentin Bartenev1-4/+127
2012-02-13Proxy: added the "proxy_cookie_domain" directive.Valentin Bartenev1-0/+202
2012-02-13Proxy: generic regex related code from the "proxy_redirect" directive movedValentin Bartenev1-23/+47
to a separate function. No functional changes.
2012-02-13Proxy: generic rewrite code from the "proxy_redirect" handlers moved to aValentin Bartenev1-44/+52
separate function with trivial optimization. No functional changes.
2012-02-13Proxy: renamed some "proxy_redirect" related declarations to a more general andValentin Bartenev1-45/+45
reusable. No functional changes.
2012-01-30Fixed proxy_redirect off inheritance.Valentin Bartenev1-0/+2
Example configuration to reproduce: server { proxy_redirect off; location / { proxy_pass http://localhost:8000; proxy_redirect http://localhost:8000/ /; location ~ \.php$ { proxy_pass http://localhost:8000; # proxy_redirect must be inherited from the level above, # but instead it was switched off here } } }
2012-01-18Copyright updated.Maxim Konovalov1-0/+1
2012-01-16Fixed proxy_cache_use_stale in "no live upstreams" case.Maxim Dounin1-5/+9
2012-01-11Added support for TLSv1.1, TLSv1.2 in ssl_protocols directive.Maxim Dounin1-1/+3
Support for TLSv1.1 and TLSv1.2 protocols was introduced in OpenSSL 1.0.1 (-beta1 was recently released). This change makes it possible to disable these protocols and/or enable them without other protocols.
2012-01-10Fixed: proxy_redirect with regex might broke Refresh header.Valentin Bartenev1-1/+19
The problem was localized in ngx_http_proxy_rewrite_redirect_regex() handler function which did not take into account prefix when overwriting header value.
2011-12-26Cache locks initial implementation.Maxim Dounin1-0/+22
New directives: proxy_cache_lock on/off, proxy_cache_lock_timeout. With proxy_cache_lock set to on, only one request will be allowed to go to upstream for a particular cache item. Others will wait for a response to appear in cache (or cache lock released) up to proxy_cache_lock_timeout. Waiting requests will recheck if they have cached response ready (or are allowed to run) every 500ms. Note: we intentionally don't intercept NGX_DECLINED possibly returned by ngx_http_file_cache_read(). This needs more work (possibly safe, but needs further investigation). Anyway, it's exceptional situation. Note: probably there should be a way to disable caching of responses if there is already one request fetching resource to cache (without waiting at all). Two possible ways include another cache lock option ("no_cache") or using proxy_no_cache with some supplied variable. Note: probably there should be a way to lock updating requests as well. For now "proxy_cache_use_stale updating" is available.
2011-12-23Proxy: made proxy_pass with variables more consistent.Maxim Dounin1-6/+3
If proxy_pass was used with variables and there was no URI component, nginx always used unparsed URI. This isn't consistent with "no variables" case, where e.g. rewrites are applied even if there is no URI component. Fix is to use the same logic in both cases, i.e. only use unparsed URI if it's valid and request is the main one.
2011-12-12Proxy: added variables and regexp support to the first parameter ofValentin Bartenev1-99/+119
the "proxy_redirect" directive.
2011-11-14Fixed Upgrade header clearing with proxy_cache.Maxim Dounin1-0/+1
This was missed in proxy HTTP/1.1 support commit (r4127).
2011-11-14Fixed proxy_set_header inheritance with proxy_set_body.Maxim Dounin1-17/+12
2011-11-14Fixed proxy_set_header inheritance with proxy_cache (ticket #45).Maxim Dounin1-9/+23
Headers cleared with cache enabled (If-Modified-Since etc.) might be cleared in unrelated servers/locations without proxy_cache enabled if proxy_cache was used in some server/location. Example config which triggered the problem: proxy_set_header X-Test "test"; server { location /1 { proxy_cache name; proxy_pass ... } } server { location /2 { proxy_pass ... } } Another one: server { proxy_cache name; location /1 { proxy_pass ... } location /2 { proxy_cache off; proxy_pass ... } } In both cases If-Modified-Since header wasn't sent to backend in location /2. Fix is to not modify conf->headers_source, but instead merge user-supplied headers from conf->headers_source and default headers (either cache or not) into separate headers_merged array.
2011-10-12Wording fix, "many data" is incorrect.Maxim Dounin1-1/+1
Noted by Piotr Sikora.
2011-09-25Proxy: logging levels tuned, double logging fixed.Maxim Dounin1-6/+3
2011-09-25Proxy: whitespaces after chunk size allowed.Maxim Dounin1-0/+4
Whitespaces after chunk size seems to be be allowed by the "implied *LWS" rule and emitted by some servers.