Skip to content

Commit c78b7dd

Browse files
committed
Merge branch 'master' of bitbucket.org:nginx-goodies/nginx-sticky-module-ng
2 parents 51efa12 + 1e96371 commit c78b7dd

File tree

3 files changed

+52
-53
lines changed

3 files changed

+52
-53
lines changed

Changelog.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

2+
1.2.5 - 2014-07-07
3+
- setting path-defaults to /
4+
fixing issue
5+
https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/issue/7/leaving-cookie-path-empty-in-module
6+
27
1.2.4 - 2014-04-18
3-
- fixed an compiling-issue on some systems (SLES)
8+
- fixed an compiling-issue on some systems (SLES, CentOS)
49
https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/issue/5/nginx-compile-warning
510

611
1.2.3 - 2014-03-10

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Modify your compile of Nginx by adding the following directive
5858
default: nothing. Let the browser handle this.
5959

6060
- path: the path in which the cookie will be valid
61-
default: nothing. Let the browser handle this.
61+
default: /
6262

6363
- expires: the validity duration of the cookie
6464
default: nothing. It's a session cookie.
@@ -88,19 +88,25 @@ Modify your compile of Nginx by adding the following directive
8888
Proxy Error) if a request comes with a cookie and the
8989
corresponding backend is unavailable.
9090

91-
- secure enable secure cookies; transfered only via https
92-
- httponly enable cookies not to be leaked to via js
91+
- secure enable secure cookies; transferred only via https
92+
- httponly enable cookies not to be leaked via js
9393

9494

9595
# Detail Mechanism
9696

9797
- see docs/sticky.{vsd,pdf}
9898

99-
# Warnings:
99+
# Issues and Warnings:
100+
101+
- when using different upstream-configs with stickyness that use the same domain but
102+
refer to different location - configs it might be wise to set a different path / route -
103+
option on each of this upstream-configs like described here:
104+
https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/issue/7/leaving-cookie-path-empty-in-module
100105

101106
- sticky module does not work with the "backup" option of the "server" configuration item.
102107
- sticky module might work with the nginx_http_upstream_check_module (up from version 1.2.3)
103108
- sticky module may require to configure nginx with SSL support (when using "secure" option)
109+
104110

105111

106112
# Contributing
@@ -120,9 +126,10 @@ see Todo.md
120126

121127
# Authors & Credits
122128

123-
- Jerome Loyet, inital module
129+
- Jerome Loyet, initial module
124130
- Markus Linnala, httponly/secure-cookies-patch
125131
- Peter Bowey, Nginx 1.5.8 API-Change
132+
- Michael Chernyak for Max-Age-Patch
126133
- anybody who suggested a patch, created an issue on bitbucket or helped improving this module
127134

128135

@@ -132,7 +139,6 @@ see Todo.md
132139
This module is licenced under the BSD license.
133140

134141
Copyright (C) 2010 Jerome Loyet (jerome at loyet dot net)
135-
Copyright (C) 2012 Markus Linnala (markus.linnala@gmail.com)
136142
Copyright (C) 2014 Markus Manzke (goodman at nginx-goodies dot com)
137143

138144

patches/upstream_check.patch

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,46 @@
1-
Index: ngx_http_sticky_module.c
2-
===================================================================
3-
--- ngx_http_sticky_module.c (revision 45)
4-
+++ ngx_http_sticky_module.c (working copy)
5-
@@ -10,6 +10,11 @@
6-
7-
#include "ngx_http_sticky_misc.h"
8-
9-
+#if (NGX_UPSTREAM_CHECK_MODULE)
10-
+#include "ngx_http_upstream_check_handler.h"
11-
+#endif
12-
+
13-
+
14-
/* define a peer */
15-
typedef struct {
16-
ngx_http_upstream_rr_peer_t *rr_peer;
17-
@@ -287,6 +292,16 @@
18-
return NGX_BUSY;
19-
}
1+
diff --git a/ngx_http_sticky_module.c b/ngx_http_sticky_module.c
2+
index 9967428..f13d4b5 100644
3+
--- a/ngx_http_sticky_module.c
4+
+++ b/ngx_http_sticky_module.c
5+
@@ -299,6 +299,16 @@ static ngx_int_t ngx_http_get_sticky_peer(ngx_peer_connection_t *pc, void *data)
6+
return NGX_BUSY;
7+
}
208

219
+#if (NGX_UPSTREAM_CHECK_MODULE)
22-
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
23-
+ "get sticky peer, check_index: %ui",
24-
+ peer->check_index);
10+
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
11+
+ "get sticky peer, check_index: %ui",
12+
+ peer->check_index);
2513
+
26-
+ if (ngx_http_check_peer_down(peer->check_index)) {
27-
+ return NGX_BUSY;
28-
+ }
14+
+ if (ngx_http_check_peer_down(peer->check_index)) {
15+
+ return NGX_BUSY;
16+
+ }
2917
+#endif
3018
+
31-
/* if it's been ignored for long enought (fail_timeout), reset timeout */
32-
/* do this check before testing peer->fails ! :) */
33-
if (now - peer->accessed > peer->fail_timeout) {
34-
@@ -303,6 +318,14 @@
35-
/* ensure the peer is not marked as down */
36-
if (!peer->down) {
19+
/* if it's been ignored for long enought (fail_timeout), reset timeout */
20+
/* do this check before testing peer->fails ! :) */
21+
if (now - peer->accessed > peer->fail_timeout) {
22+
@@ -315,6 +325,14 @@ static ngx_int_t ngx_http_get_sticky_peer(ngx_peer_connection_t *pc, void *data)
23+
/* ensure the peer is not marked as down */
24+
if (!peer->down) {
3725

3826
+#if (NGX_UPSTREAM_CHECK_MODULE)
39-
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
40-
+ "get sticky peer, check_index: %ui",
41-
+ peer->check_index);
27+
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
28+
+ "get sticky peer, check_index: %ui",
29+
+ peer->check_index);
4230
+
43-
+ if (!ngx_http_check_peer_down(peer->check_index)) {
31+
+ if (!ngx_http_check_peer_down(peer->check_index)) {
4432
+#endif
4533
+
46-
/* if it's not failedi, use it */
47-
if (peer->max_fails == 0 || peer->fails < peer->max_fails) {
48-
selected_peer = (ngx_int_t)n;
49-
@@ -317,6 +340,9 @@
50-
/* mark the peer as tried */
51-
iphp->rrp.tried[n] |= m;
52-
}
34+
/* if it's not failedi, use it */
35+
if (peer->max_fails == 0 || peer->fails < peer->max_fails) {
36+
selected_peer = (ngx_int_t)n;
37+
@@ -329,6 +347,9 @@ static ngx_int_t ngx_http_get_sticky_peer(ngx_peer_connection_t *pc, void *data)
38+
/* mark the peer as tried */
39+
iphp->rrp.tried[n] |= m;
40+
}
5341
+#if (NGX_UPSTREAM_CHECK_MODULE)
54-
+ }
42+
+ }
5543
+#endif
56-
}
57-
}
58-
}
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)