summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules/ngx_http_proxy_module.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-11-19Proxy: renamed and rearranged fields in proxy configuration.Roman Arutyunyan1-16/+15
No functional changes.
2014-11-19Upstream: different header lists for cached and uncached requests.Roman Arutyunyan1-19/+33
The upstream modules remove and alter a number of client headers before sending the request to upstream. This set of headers is smaller or even empty when cache is disabled. It's still possible that a request in a cache-enabled location is uncached, for example, if cache entry counter is below min_uses. In this case it's better to alter a smaller set of headers and pass more client headers to backend unchanged. One of the benefits is enabling server-side byte ranges in such requests.
2014-11-19Upstream: moved header lists to separate structures.Roman Arutyunyan1-40/+49
No functional changes.
2014-11-19Upstream: moved header initializations to separate functions.Roman Arutyunyan1-20/+19
No functional changes.
2014-11-18Cache: proxy_cache_lock_age and friends.Roman Arutyunyan1-0/+11
Once this age is reached, the cache lock is discarded and another request can acquire the lock. Requests which failed to acquire the lock are not allowed to cache the response.
2014-10-30Upstream: add "proxy_ssl_certificate" and friends.Piotr Sikora1-0/+81
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-10-28Upstream: proxy_limit_rate and friends.Roman Arutyunyan1-0/+11
The directives limit the upstream read rate. For example, "proxy_limit_rate 42" limits proxy upstream read rate to 42 bytes per second.
2014-10-14Upstream: proxy_force_ranges and friends.Roman Arutyunyan1-0/+11
The directives enable byte ranges for both cached and uncached responses regardless of backend headers.
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.