flytigerboy / nginx-sticky-module Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/nginx-sticky-module
License: Other
Automatically exported from code.google.com/p/nginx-sticky-module
License: Other
I have packaged nginx 1.4.1 for Ubutu 12.04 LTS precise and the packages were
successfully built on launchpad.net.
What steps will reproduce the problem?
1. Make sure you are using Ubuntu Precise.
2. Grab the packages from
https://launchpad.net/~andreas-otto/+archive/nginx/+packages and install the
two packages nginx-common and nginx-loadbalancer
3. Change the default configuration to (or use the one attached):
upstream myproject {
sticky;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}
server {
listen 80 default_server;
server_name localhost;
location / {
proxy_pass http://myproject;
}
}
server {
listen 8001 default_server;
root /usr/share/nginx/html;
server_name localhost;
location / {
try_files $uri /8001.html;
}
}
server {
listen 8002 default_server;
root /usr/share/nginx/html;
server_name localhost;
location / {
try_files $uri /8002.html;
}
}
4. Create two files 8001.html and 8002.html in the folder /usr/share/nginx/html
(or use the one attached).
5. Stop nginx
6. Start nginx
What is the expected output? What do you see instead?
I would expect to see the content of either 8001.html or 8002.html. Instead the
server does not even start and the error log shows:
2013/06/02 13:20:34 [emerg] 5392#0: unknown directive "sticky" in
/etc/nginx/sites-enabled/loadbalancer:2
What version of the product are you using? On what operating system?
Version of nginx-sticky-module: 1.1
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04
Codename: precise
Nginx: 1.4.1 from https://launchpad.net/~andreas-otto/+archive/nginx/+packages.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 2 Jun 2013 at 1:42
Attachments:
Sticky module is based on a best effort algorithm. If the client comes with a
cookie, it does it best to send the request to the corresponding backend.
But if the backend is unavailable, it will fallback to another backend and send
the client a new cookie.
This behaviour could (in some specific cases) be unwanted. Lets take un
example: I'm hosting a voting application and the backend application does not
support session sharing between backends. Which means that a client MUST always
be sent to the very same backend no matter what. If the backend is unavailable,
in this case I don't want the sticky module to fallback and I prefer my client
to have an error page.
Original issue reported on code.google.com by [email protected]
on 21 Sep 2011 at 5:03
What steps will reproduce the problem?
1. Open ngx_http_sticky_misc.c
2. View http://wiki.nginx.org/Nginx_coding_style
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
1) 4 space indentation, no tabs
2) 2 line breaks between blocks at global level
3) C style comments only
4) Line breaks ~75 characters
Original issue reported on code.google.com by [email protected]
on 26 Jun 2010 at 11:29
Attachments:
What steps will reproduce the problem?
1. nginx.conf:
upstream cluster {
sticky;
server 192.168.0.61:8081;
server 192.168.0.61:8082;
check interval=3000 rise=2 fall=5 timeout=1000 type=http;
check_http_send "GET /keepalive.html HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
server {
listen 80;
server_name localhost;
location /stat {
check_status;
}
location /test {
proxy_pass http://cluster/service1/test.html;
error_log /var/log/nginx/error.log debug;
}
...
cat /var/www/8081/service1/test.html
This is 8081
cat /var/www/8082/service1/test.html
This is 8082
2. Remove the /keepalive.html file from 8081 peer's DocumentRoot and check
http://localhost/stat
3. Brows http://127.0.0.1/test - notice content continue to serve 8081
4. Shutdown the 8081 peer service port - after sometimes it routes to 8082
What is the expected output?
nginx should not serve the 8081 peer as we removed the /keepalive.html from
8081 to glitch the service.
What do you see instead?
nginx continue to serve the 8081 while nginx_http_upstream_check_module /stat
shows the 8081 server down. It continues to serve until we shutdown the 8081
service port.
What version of the product are you using? On what operating system?
nginx version: nginx/1.2.1-1
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
TLS SNI support disabled
configure arguments: --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx
--with-http_ssl_module --with-http_realip_module --with-http_addition_module
--with-http_sub_module --with-http_dav_module --with-http_flv_module
--with-http_mp4_module --with-http_gzip_static_module
--with-http_random_index_module --with-http_secure_link_module
--with-http_stub_status_module --with-mail_ssl_module --with-file-aio
--with-debug --with-cc-opt='-O2 -g -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables' --without-http_uwsgi_module
--without-http_scgi_module --without-mail_pop3_module
--without-mail_imap_module --without-mail_smtp_module
--add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/simpl-ngx_de
vel_kit-24202b4
--add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/agentzh-echo
-nginx-module-080c0a1
--add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/agentzh-set-
misc-nginx-module-87d0ab2
--add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/mikewest-ngi
nx-static-etags-25bfaf9
--add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/nginx-sticky
-module-1.0
--add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/agentzh-memc
-nginx-module-8befc56
--add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/agentzh-srca
che-nginx-module-8df221e
--add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.2.1/contrib/yaoweibin-ng
inx_upstream_check_module-dfee401
uname -rop
2.6.18-194.el5PAE i686 GNU/Linux
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Please provide any additional information below.
I think nginx-sticky got the previous cookie and found the peer match which is
the failed server and continue to maintain the previous session. If I shutdown
the server/port, then sticky tries available peers and create a new session
with available upstream server.
http://forum.nginx.org/read.php?2,227937
debug logs:
service down, service port still up - http://pastebin.com/S9wJFkmR
service down, service port down- http://pastebin.com/HSjMMs75
Original issue reported on code.google.com by [email protected]
on 26 Jun 2012 at 7:41
What steps will reproduce the problem?
1. nginx with 2 upstream servers in the backend s1, s2
2. Client connects, nginx routes to s1
3. s1 marked as down in config, nginx config is reloaded
4. Requests from the same client continue going to s1, instead of s2
What is the expected output? What do you see instead?
nginx should automatically route traffic to the second server.
Instead, I see that traffic still goes to the "down" server from the clients
which are already "sticking" to it.
What version of the product are you using? On what operating system?
1.0-rc2 on Ubuntu (2.6.35.11-83.9.amzn1.i686) on an EC2 instance. Full output
from uname -
Linux ip-10-251-39-48 2.6.35.11-83.9.amzn1.i686 #1 SMP Sat Feb 19 23:41:56 UTC
2011 i686 i686 i386 GNU/Linux
Please provide any additional information below.
I'm using nginx solely as a load balancer, with nginx-sticky
(https://code.google.com/p/nginx-sticky-module/) as a way to maintain sticky
sessions.
There are 2 upstream servers configured - and I have to occasionally mark one
of them as down. When I do this, failover from clients that have a sticky
session cookie does not happen to the other upstream server (which is up).
Original issue reported on code.google.com by [email protected]
on 21 Jul 2011 at 9:41
Hello, I'm attempting to add this module to the FreeBSD www/nginx port. With
ssl enabled, the port and module compiles and works just fine.
However, without ngx_ssl_module, the build fails.
make -f objs/Makefile
cc -c -O2 -pipe -fno-strict-aliasing -I /usr/local/include -I src/core -I
src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I
src/http/modules -I src/mail -o
objs/addon/nginx-sticky-module-1.0/ngx_http_sticky_misc.o
/root/nginx/work/nginx-sticky-module-1.0/ngx_http_sticky_misc.c
/root/nginx/work/nginx-sticky-module-1.0/ngx_http_sticky_misc.c: In function
'ngx_http_sticky_misc_hmac_md5':
/root/nginx/work/nginx-sticky-module-1.0/ngx_http_sticky_misc.c:155: error:
'MD5_CBLOCK' undeclared (first use in this function)
/root/nginx/work/nginx-sticky-module-1.0/ngx_http_sticky_misc.c:155: error:
(Each undeclared identifier is reported only once
/root/nginx/work/nginx-sticky-module-1.0/ngx_http_sticky_misc.c:155: error: for
each function it appears in.)
*** Error code 1
Stop in /root/nginx/work/nginx-1.2.0.
*** Error code 1
Stop in /root/nginx/work/nginx-1.2.0.
*** Error code 1
Stop in /root/nginx.
*** Error code 1
Stop in /root/nginx.
It seems like ssl should not be a dependancy, or if it is, at least have it
documented
Environment:
# uname -a
FreeBSD www-dev 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC
2012 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
# gcc -v
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]
Nginx version: 1.2.0
Thanks
Mike C
Original issue reported on code.google.com by [email protected]
on 2 May 2012 at 3:57
What steps will reproduce the problem?
1. View source file
2. View http://wiki.nginx.org/Nginx_coding_style
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
1) Added header guard
2) 2 line breaks between blocks at global level
3) Line breaks before ~80 characters
Will open different issues for C source files.
Original issue reported on code.google.com by [email protected]
on 26 Jun 2010 at 11:13
Attachments:
What steps will reproduce the problem?
1. Try to download tarball with curl
2. Get HTML response that indicates your browser is not supported by
code.google.com
What is the expected output? What do you see instead?
I would want to see the actual tarball that I was trying to download.
What version of the product are you using? On what operating system?
I'm trying to download version 1.0 of the tarball, and I've used both CentOS
5.6 and MacOS X 10.6.6 as my client OSes. Same issue in both OSes.
Please provide any additional information below.
Don't know that I can provide any more detail. Feel free to contact me via
e-mail to [email protected] or [email protected]. Thanks!
Original issue reported on code.google.com by [email protected]
on 16 Apr 2012 at 5:01
What steps will reproduce the problem?
1. set 2 upstream
2. request one page to get a sticky cookie
3. stop the upstream relative to the given sticky cookie
4. request the same page as #2 with the given cookie
What is the expected output?
nginx should switch to on working peer and returns the result
What do you see instead?
nginx switch to the same peer and returns 502
Original issue reported on code.google.com by [email protected]
on 21 Jul 2011 at 12:31
upstream /toto {
sticky;
server 127.0.0.1:8900;
}
it segfault at runtime (it starts well)
Original issue reported on code.google.com by [email protected]
on 13 Sep 2011 at 1:44
This is make error:
cc -c -I /home/mimiko/src/nginx-modules/ngx_http_js_module/src/ -pipe -O -W
-Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I/opt/GeoIP/include
-I/opt/gperftools/include -I/opt/ffmpeg/include
-I/opt/ImageMagick/include/ImageMagick-6 -Wno-error=unused-but-set-variable
-DMAGICKCORE_QUANTUM_DEPTH=32 -DMAGICKCORE_HDRI_ENABLE=0 -DNDK_SET_VAR
-I/home/mimiko/src/nginx-modules/nginx-rtmp-module
-I/home/mimiko/src/nginx-modules/ngx_http_lower_upper_case -DNDK_SET_VAR
-DNDK_UPSTREAM_LIST -I/home/mimiko/src/nginx-modules/ngx_http_php_session
-DNDK_SET_VAR -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_SET_VAR
-Wno-unused-function -Wno-missing-field-initializers -D_POSIX_C_SOURCE=200112L
--std=c99 -Isrc -I src/core -I src/event -I src/event/modules -I src/os/unix
-I /home/mimiko/src/nginx-modules/ngx_devel_kit/objs -I objs/addon/ndk -I
/opt/libpq/include -I /opt/spidermonkey/include -I
/home/mimiko/src/nginx-modules/nginx-video-thumbextractor-module/src -I
/home/mimiko/src/nginx-modules/nginx-video-thumbextractor-module/include -I
/opt/sregex/include -I /opt/luajit/include/luajit-2.0 -I
/opt/luajit/include/luajit-2.0 -I
/home/mimiko/src/nginx-modules/lua-nginx-module/src/api -I
/home/mimiko/src/nginx-modules/nginx-push-stream-module/src -I
/home/mimiko/src/nginx-modules/nginx-push-stream-module/include -I
/home/mimiko/src/nginx-modules/nginx_http_push_module/src -I
/home/mimiko/src/nginx-modules/nginx-selective-cache-purge-module/src -I
/home/mimiko/src/nginx-modules/nginx-selective-cache-purge-module/include -I
../pcre -I ../openssl/.openssl/include -I ../zlib -I /usr/include/libxml2 -I
objs -I src/http -I src/http/modules -I src/http/modules/perl -I
/home/mimiko/src/nginx-modules/ngx_devel_kit/src -I
/home/mimiko/src/nginx-modules/nginx-http-sysguard -I src/mail \
-o objs/addon/nginx-sticky-module/ngx_http_sticky_misc.o \
/home/mimiko/src/nginx-modules/nginx-sticky-module/ngx_http_sticky_misc.c
/home/mimiko/src/nginx-modules/nginx-sticky-module/ngx_http_sticky_misc.c: In
function Б─≤ngx_http_sticky_misc_text_rawБ─≥:
/home/mimiko/src/nginx-modules/nginx-sticky-module/ngx_http_sticky_misc.c:281:2:
error: passing argument 2 of Б─≤ngx_sock_ntopБ─≥ makes integer from
pointer without a cast [-Werror]
In file included from src/core/ngx_core.h:69:0,
from /home/mimiko/src/nginx-modules/nginx-sticky-module/ngx_http_sticky_misc.c:8:
src/core/ngx_inet.h:110:8: note: expected Б─≤socklen_tБ─≥ but
argument is of type Б─≤u_char *Б─≥
/home/mimiko/src/nginx-modules/nginx-sticky-module/ngx_http_sticky_misc.c:281:2:
error: passing argument 3 of Б─≤ngx_sock_ntopБ─≥ makes pointer from
integer without a cast [-Werror]
In file included from src/core/ngx_core.h:69:0,
from /home/mimiko/src/nginx-modules/nginx-sticky-module/ngx_http_sticky_misc.c:8:
src/core/ngx_inet.h:110:8: note: expected Б─≤u_char *Б─≥ but argument
is of type Б─≤size_tБ─≥
/home/mimiko/src/nginx-modules/nginx-sticky-module/ngx_http_sticky_misc.c:281:2:
error: too few arguments to function Б─≤ngx_sock_ntopБ─≥
In file included from src/core/ngx_core.h:69:0,
from /home/mimiko/src/nginx-modules/nginx-sticky-module/ngx_http_sticky_misc.c:8:
src/core/ngx_inet.h:110:8: note: declared here
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/nginx-sticky-module/ngx_http_sticky_misc.o] Error 1
make[1]: Leaving directory `/home/mimiko/src/nginx'
make: *** [build] Error 2
I'm on Debian Wheezy x86_64. Nginx and module are latest fromg git and svn.
Original issue reported on code.google.com by [email protected]
on 1 Mar 2014 at 9:42
What steps will reproduce the problem?
1. check http headers returned by nginx with nginx-sticky-module-1.1 and
"expires" parameter set for the sticky backend
What is the expected output? What do you see instead?
Expected: Set-Cookie:route=foo; Domain=bar; Expires=date
Got: Set-Cookie:route=foo; Domain=bar; Max-Age=seconds
What version of the product are you using? On what operating system?
nginx-sticky-module-1.1
Please provide any additional information below.
Internet Explorer <9 doesn't understand Max-Age. Expires should be used
instead, as it's understood by all browsers
Patch is provided
Original issue reported on code.google.com by [email protected]
on 8 Nov 2013 at 10:54
Attachments:
What steps will reproduce the problem?
1. Configure NginX 1.0.5 with nginx-sticky-module
2. Run 'make' command
What is the expected output? What do you see instead?
Expected output should be 'OK'.
I receive following error:
gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter
-Wunused-function -Wunused-variable -Wunused-value -Werror -g -I src/core -I
src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I
src/http/modules -I src/mail \
-o objs/addon/nginx-sticky-module-1.0/ngx_http_sticky_module.o \
/usr/src/nginx-sticky-module-1.0//ngx_http_sticky_module.c
/usr/src/nginx-sticky-module-1.0//ngx_http_sticky_module.c: In function
`ngx_http_get_sticky_peer':
/usr/src/nginx-sticky-module-1.0//ngx_http_sticky_module.c:259: warning: 'm'
might be used uninitialized in this function
/usr/src/nginx-sticky-module-1.0//ngx_http_sticky_module.c:260: warning: 'n'
might be used uninitialized in this function
make[1]: *** [objs/addon/nginx-sticky-module-1.0/ngx_http_sticky_module.o]
Error 1
make[1]: Leaving directory `/usr/src/nginx-1.0.5'
make: *** [build] Error 2
What version of the product are you using? On what operating system?
NginX 1.0.5 , CentOS 4.6 64bit
Please provide any additional information below.
Firstly I tried with NginX 1.0.15 and received same error. I saw, that this
module has been tested with 1.0.5 so I thought,
that this is versions issue, however, with 1.0.5 and 1.0.0 error is the same.
Original issue reported on code.google.com by [email protected]
on 22 Apr 2012 at 12:45
What steps will reproduce the problem?
1. len += sizeof("; Max-Age=") - 1 + sizeof("1275396350") - 1;
2. p = ngx_snprintf(p, sizeof("1275396350") - 1, "%T", expires);
3. remove.len = sizeof("_remove_") - 1;
4. remove.data = (u_char *) "_remove_";
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
1) Use NGX_TIME_T_LEN instead of sizeof("1275396350"). This should also work
on systems with a 64-bit time_t.
2) Use ngx_str_set for conciseness with string constants. This macro is not
available for versions < 0.8.37. The following may be placed in
ngx_http_sticky_misc.c:
#ifndef ngx_str_set
#define ngx_str_set(str, text) \
(str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
#endif
see src/core/ngx_string.h in 0.8.37 or up for details.
Original issue reported on code.google.com by [email protected]
on 27 Jun 2010 at 2:47
What steps will reproduce the problem?
1. install sticky module and launch nginx with several upstream servers
configured
2. browse the website that the LB is serving and check the "route" cookie
3. run md5sum on each one of the upstream server addresses and notice that the
route cookie does not match any of the md5sums of the upstream server
addresses.
What is the expected output? What do you see instead?
I expected to be able to md5sum one of the upstream IP addresses so that I can
modify my cookie and 'stick' myself to a particular upstream server. Instead,
I'm not able to figure out what I need to md5sum to come up with the same value
that is being used by the cookie.
What version of the product are you using? On what operating system?
1.1 on Centos 6.3
Please provide any additional information below.
I just need to know how to come up with the same md5sum that you the route
cookie is coming up with.
Here is my upstream block:
upstream backend {
sticky name=SERVERID path=/;
check interval=3000 rise=2 fall=3 timeout=1000 type=http;
check_http_send "GET /admin/health/check HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
server 10.206.6.95:80;
server 10.90.177.39:80;
server 10.114.231.99:80;
server 10.159.35.44:80;
}
And here is the value of the route (actually called SERVERID) cookie that I'm
seeing in my browser:
1d2bbfb597e3514ba73a6326a3c38735
I tried running md5sum on all of my upstream IP's (with and without :80
attached) and all of the values I get don't match the cookie. Can you tell me
exactly what part of the upstream address is going into the md5sum to generate
the route cookie?
Thanks
Original issue reported on code.google.com by [email protected]
on 10 Jan 2013 at 12:20
What steps will reproduce the problem?
1. Each sticky request invokes one or more MD5 calls.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
It should be possible to build two maps during module initialization:
upstream_host_and_port --> hash_value
hash_value --> upstream_host_and_port
This would eliminate dynamic calls to MD5. An incoming request can use its
cookie value to find the host. An outgoing request with a new cookie can
use the host value to find its cookie.
Original issue reported on code.google.com by [email protected]
on 6 Jun 2010 at 2:14
What steps will reproduce the problem?
1.
proxy_cache_path /dev/shm/cache/nginx/html levels=1:2 keys_zone=static-cache:30m inactive=1d max_size=500M;
proxy_temp_path /dev/shm/cache/nginx/html/tmp 1 2;
proxy_cache_key "$request_method$uri$cookie_route";
upstream a {
sticky hash=sha1;
server localhost:8081 weight=1;
server localhost:8082 weight=2;
}
server {
listen 8081;
location / {
root /home/ec2-user/8081;
}
}
server {
listen 8082;
location / {
root /home/ec2-user/8082;
}
}
2.
location /test {
proxy_pass http://a/;
add_header X-Cache-Status $upstream_cache_status;
proxy_cache "static-cache";
proxy_cache_valid 200 3600m;
proxy_cache_min_uses 1;
proxy_cache_use_stale error timeout invalid_header http_500;
proxy_ignore_headers "X-Accel-Expires" "Expires" "Cache-Control" "Set-Cookie";
}
3.
What is the expected output? What do you see instead?
I have two versions of application and want to distribute it to two set of
users. I have proxy cache enabled.
The route cookie is set after the first response from the server. So the first
request is cached without cookie. Due to this cache all the users will see only
one version of the first page, next page onwards it would be fine.
What version of the product are you using? On what operating system?
nginx version: nginx/1.2.0
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configure arguments: --prefix=/opt/nginx --pid-path=/home/ec2-user/pids
--user=akpandey --group=akpandey --with-http_realip_module
--with-http_addition_module --with-http_xslt_module --with-http_sub_module
--with-http_gzip_static_module --with-http_stub_status_module
--with-http_secure_link_module --without-mail_pop3_module
--without-mail_imap_module --without-mail_smtp_module --with-http_mp4_module
--add-module=/home/ec2-user/Downloads/nginx-sticky-module-1.1/
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 9 Dec 2012 at 12:19
Hi there,
we got a question regarding the mechanism if no route cookie is found:
"When the sticky module can't apply, it switchs back to the classic Round Robin
or returns a "Bad Gateway""
Is it possible to let the sticky module use the least_conn mechanism instead of
the "classic Round Robin"?
best regards
Jens
Original issue reported on code.google.com by [email protected]
on 12 Nov 2012 at 6:00
What steps will reproduce the problem?
1. View ngx_http_sticky_module.c
2. View http://wiki.nginx.org/Nginx_coding_style
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
1) 4 space indentation, no tabs
2) 2 line breaks between blocks at global level
3) Keep lines ~80 characters long
Original issue reported on code.google.com by [email protected]
on 27 Jun 2010 at 12:20
Attachments:
What steps will reproduce the problem?
1.Build nginx with sticky module
2.Create a balanced backend
3.assing to any node the value "weight" or "backup"
What is the expected output? What do you see instead?
Proxy working/syntax error:
nginx: [emerg] invalid parameter "backup" in
/etc/nginx/conf.d/jboss_balancer.conf:4
nginx: configuration file /etc/nginx/nginx.conf test failed
Contents of jboss_balancer.conf file:
####
upstream backend {
sticky;
server 10.170.231.187:8080 max_fails=3 fail_timeout=30s;
server 10.172.247.131:8080 max_fails=3 fail_timeout=30s backup;
}
####
Removing the sticky option, it works.
What version of the product are you using? On what operating system?
nginx-1.0.12
nginx-sticky-module-1.0
Amazon Linux AMI release 2011.09
Please provide any additional information below.
Nginx builtd with:
[root@amazon etc]# /home/apps/nginx-1.0.12/sbin/nginx -V
nginx version: nginx/1.0.12
built by gcc 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC)
TLS SNI support enabled
configure arguments: --without-mail_pop3_module --without-mail_imap_module
--without-mail_smtp_module --conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/nginx_error.log --pid-path=/var/run/nginx.pid
--lock-path=/var/lock/nginx.lock
--http-log-path=/var/log/nginx/nginx_access.log
--http-client-body-temp-path=/var/lib/nginx/body
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-fastcgi-temp-path=/dev/shm/nginx --with-debug
--with-http_stub_status_module --with-http_flv_module --with-http_ssl_module
--with-http_dav_module --with-http_gzip_static_module
--prefix=/home/apps/nginx-1.0.12 --add-module=../ngx_cache_purge-1.5
--add-module=../nginx-sticky-module-1.0
Original issue reported on code.google.com by [email protected]
on 1 Mar 2012 at 3:45
What steps will reproduce the problem?
Configuration:
upstream {
sticky name=route_nginx path=/nginx/route/;
server 127.0.0.1:9000;
server 127.0.0.1:9001;
}
There is a situation duiring site working - we can see 2 cookies:
nginx_route d47b50913234693602f7cbf745d9cc15 /PSIX/SCX/ (Session)
nginx_route c021bed7184123de44aea3db1f16319e /nginx/route/ (Session)
The second cookie was created by site. Question: how does sticky-module choose
one of two cookies with the same name?
What is the expected output? What do you see instead?
The cookie must be selected from the parameter 'path'
Original issue reported on code.google.com by [email protected]
on 17 Sep 2013 at 10:45
What steps will reproduce the problem?
1. View ngx_http_sticky_misc.c for NGX_CONF_UNSET usage
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
NGX_CONF_UNSET should be checked for equality only, not for any specific value.
if (expires > NGX_CONF_UNSET) {
should be:
if (expires != NGX_CONF_UNSET) {
two instances in ngx_http_sticky_misc.c
Original issue reported on code.google.com by [email protected]
on 27 Jun 2010 at 4:28
What steps will reproduce the problem?
1. Edit ngx_http_sticky_misc.c
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
The hashing and string methods do not use a terminating NULL byte. Therefore,
the following calls do not need the + 1:
< cookie = ngx_pnalloc(r->pool, len + 1);
< u_char hash[MD5_DIGEST_LENGTH + 1];
< digest->data = ngx_pcalloc(pool, (MD5_DIGEST_LENGTH * 2) + 1);
< u_char hash[SHA_DIGEST_LENGTH + 1];
< digest->data = ngx_pcalloc(pool, (SHA_DIGEST_LENGTH * 2) + 1);
< u_char hash[MD5_DIGEST_LENGTH + 1];
< digest->data = ngx_pcalloc(pool, (MD5_DIGEST_LENGTH * 2) + 1);
< u_char hash[SHA_DIGEST_LENGTH + 1];
< digest->data = ngx_pcalloc(pool, (SHA_DIGEST_LENGTH * 2) + 1);
In addition, the ngx_pcalloc calls add extra overhead by zero'ing out the
memory. The memory will be overwritten by the hashing calls, anyway. Suggest
replacing ngx_pcalloc with ngx_pnalloc.
Original issue reported on code.google.com by [email protected]
on 2 Jul 2010 at 1:54
What steps will reproduce the problem?
1. It is not possible to use SHA-1 and/or an HMAC.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
It may prove useful to add two configuration options to the existing ones
(name, domain, etc.):
1) hash=md5|sha1 # default is md5
2) key=path_to_file # optional
path_to_file should contain a base-64 encoded string, which would be used
for generating HMAC values instead of a straight hash. This makes guessing
valid upstream hosts more difficult for malicious users in the case the
upstream hosts can be guessed (server1, server2, etc.).
Original issue reported on code.google.com by [email protected]
on 6 Jun 2010 at 2:21
What steps will reproduce the problem?
1. Compile with nginx core 1.0.5 or 0.7.69
What is the expected output? What do you see instead?
Should compile OK, but I actually see
gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter
-Wunused-function -Wunused-variable -Wunused-value -g -O2 -g -I src/core -I
src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I
src/http/modules -I src/http/modules/perl -I src/mail \
-o objs/addon/nginx-sticky-module-1.0-rc4/ngx_http_sticky_module.o \
/root/rpmbuild/BUILD/nginx-sticky-module-1.0-rc4/ngx_http_sticky_module.c
/root/rpmbuild/BUILD/nginx-sticky-module-1.0-rc4/ngx_http_sticky_module.c:310:12
7: error: macro "ngx_log_debug1" requires 5 arguments, but only 4 given
/root/rpmbuild/BUILD/nginx-sticky-module-1.0-rc4/ngx_http_sticky_module.c: In
function 'ngx_http_get_sticky_peer':
/root/rpmbuild/BUILD/nginx-sticky-module-1.0-rc4/ngx_http_sticky_module.c:310:
error: 'ngx_log_debug1' undeclared (first use in this function)
/root/rpmbuild/BUILD/nginx-sticky-module-1.0-rc4/ngx_http_sticky_module.c:310:
error: (Each undeclared identifier is reported only once
/root/rpmbuild/BUILD/nginx-sticky-module-1.0-rc4/ngx_http_sticky_module.c:310:
error: for each function it appears in.)
make[1]: *** [objs/addon/nginx-sticky-module-1.0-rc4/ngx_http_sticky_module.o]
Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/root/rpmbuild/BUILD/nginx-1.0.5'
make: *** [build] Error 2
What version of the product are you using? On what operating system?
RHEL6
Trying with nginx 1.0.5 or 0.7.69
using nginx-sticky-module 1.0-rc4
Original issue reported on code.google.com by [email protected]
on 27 Jul 2011 at 5:42
Just a simple request - It would be awesome to be able to set the cookie to
toggle on both of the cookie settings mentioned in the title.
Original issue reported on code.google.com by [email protected]
on 25 Sep 2012 at 1:36
What steps will reproduce the problem?
1. try to compile module with nginx-1.5.12
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
here's patch:
diff -u -r nginx-sticky-module-read-only/ngx_http_sticky_misc.c
nginx-sticky-module-nginx-sticky-module-1.2/ngx_http_sticky_misc.c
--- nginx-sticky-module-read-only/ngx_http_sticky_misc.c Tue Apr 1
23:58:58 2014
+++ nginx-sticky-module-nginx-sticky-module-1.2/ngx_http_sticky_misc.c Thu Feb
6 09:48:56 2014
@@ -278,8 +278,11 @@
if (digest->data == NULL) {
return NGX_ERROR;
}
+#if defined(nginx_version) && nginx_version >= 1005003
+ digest->len = ngx_sock_ntop(in, len, digest->data, len, 1);
+#else
digest->len = ngx_sock_ntop(in, digest->data, len, 1);
- return NGX_OK;
+#endif
return NGX_OK;
}
Original issue reported on code.google.com by [email protected]
on 1 Apr 2014 at 6:01
What steps will reproduce the problem?
1. View ngx_http_sticky_misc.c
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
p = ngx_copy(p, "; Max-Age=", sizeof("; Max_Age=") - 1);
Note that the second string uses an underscore instead of a hyphen. Does not
affect correctness, as the string is the same length but is a code smell.
Original issue reported on code.google.com by [email protected]
on 27 Jun 2010 at 4:45
What steps will reproduce the problem?
1. The number of arguments to ngx_http_get_variable changed between 8035
and 8036.
2. Compile against 0.8.35 and 0.8.36
3.
What is the expected output? What do you see instead?
ngx_http_get_variable originally accepted 4 arguments. As of 0.8.36, it
accepts 3.
What version of the product are you using? On what operating system?
0.8.35, 0.8.36, Ubuntu latest
Please provide any additional information below.
I have provided a patch which compiles successfully for all nginx versions
>= 0.7.65.
Original issue reported on code.google.com by [email protected]
on 6 Jun 2010 at 2:05
Attachments:
Hi,
I need to be able to manipulate and compute valid hash value outside nginx; to
be able to do the same hash process outside nginx.
the actual hash process use internal nginx binary data to create hash.
It is possible to change it to a more portable way, so i can calculate valid
hash value outside nginx? for instance, using string value representing server
address.
Thanks in advance.
David
Original issue reported on code.google.com by [email protected]
on 24 May 2012 at 12:55
What steps will reproduce the problem?
1. View ngx_http_sticky_misc.c
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Two instances of:
elt = (ngx_table_elt_t *) part->elts;
The cast is not needed in C, and could be removed. The cast would be needed in
C++, as part->elts is a pointer to void (or possibly static_cast<>).
Original issue reported on code.google.com by [email protected]
on 27 Jun 2010 at 6:33
What steps will reproduce the problem?
1. Make a upstream like this
upstream backend {
sticky name=route;
server 1.1.1.1:8080 max_fails=3 fail_timeout=30s;
server 1.1.1.2:8080 max_fails=3 fail_timeout=30s;
}
server {
listen 443;
ssl on;
ssl_certificate /some/path/cert.crt;
ssl_certificate_key /some/path/cert.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:+MEDIUM:!SSLv2:!EXP:!ADH:!aNULL:!eNULL:!NULL;
server_name domain.abc.com;
rewrite ^/(.*)/$ /$1 break;
location / {
proxy_pass http://backend;
proxy_pass_header Server;
}
}
2. After access the URL for awhile (about 1 hours), the request header has sent
2 cookie name in the same Cookie with the same value like below :
route=123109381290
route=123109381290
3. This cause some malfuntion to the website, and the backend server refused to
accept this cookie
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
OS : CentOS 5.8 x64
Web Server : Nginx-1.0.13
Latest Nginx sticky module
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 22 Aug 2012 at 5:06
What steps will reproduce the problem?
1.RedHat 6.5
2.nginx version: nginx/1.6.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
TLS SNI support enabled
configure arguments: --with-http_ssl_module
--with-openssl=/root/inst/nginx/openssl-1.0.1h
--add-module=/root/inst/nginx/nginx-goodies-nginx-sticky-module-ng-c825ea7c5c91
3. conf file
upstream ui {
server 10.56.144.34:80 weight=4 max_fails=3 fail_timeout=120s;
server 10.56.144.32:80 weight=4 max_fails=3 fail_timeout=120s;
server 10.56.144.36:80 weight=4 max_fails=3 fail_timeout=120s;
sticky;
What is the expected output? What do you see instead?
nginx -s reload doesn't work
unknown directive "sticky" in <conf file>
What version of the product are you using? On what operating system?
Please provide any additional information below.
Thanks so much,
Meir
Original issue reported on code.google.com by [email protected]
on 8 Jul 2014 at 8:58
What steps will reproduce the problem?
1. download most recent version of nginx and put your module into directory
2. ./configure --error-log-path=path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module
--with-http_realip_module --with-http_ssl_module
--with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl
--add-module=nginx-sticky-module-1.1
3. make
(the above worked fine on 1.5.1, but fails with 1.5.6)
What is the expected output? What do you see instead?
expecting above to work, but this is the error:
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I
src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http
-I src/http/modules -I src/mail \
-o objs/addon/nginx-sticky-module-1.1/ngx_http_sticky_misc.o \
nginx-sticky-module-1.1/ngx_http_sticky_misc.c
nginx-sticky-module-1.1/ngx_http_sticky_misc.c: In function
ângx_http_sticky_misc_text_rawâ:
nginx-sticky-module-1.1/ngx_http_sticky_misc.c:281:2: error: passing argument 2
of ângx_sock_ntopâ makes integer from pointer without a cast [-Werror]
src/core/ngx_inet.h:110:8: note: expected âsocklen_tâ but argument is of type
âu_char *â
nginx-sticky-module-1.1/ngx_http_sticky_misc.c:281:2: error: passing argument 3
of ângx_sock_ntopâ makes pointer from integer without a cast [-Werror]
src/core/ngx_inet.h:110:8: note: expected âu_char *â but argument is of type
âsize_tâ
nginx-sticky-module-1.1/ngx_http_sticky_misc.c:281:2: error: too few arguments
to function ângx_sock_ntopâ
src/core/ngx_inet.h:110:8: note: declared here
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/nginx-sticky-module-1.1/ngx_http_sticky_misc.o] Error 1
make[1]: Leaving directory `/root/nginx-1.5.6'
make: *** [build] Error 2
What version of the product are you using? On what operating system?
nginx 1.5.6 and 1.0.1 of your module. running on ubuntu 12.04.
again, works fine with nginx 1.5.1.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 16 Oct 2013 at 3:57
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.