Mod_parsed_vars question

Hi.

I want to balance with URLSessionID like
http://zzzzz.com/index.php?PHPSESSID=XXXXXX
^^^^^^^^^^^^^^^^
So, I recompiled nginx-0.6.31 with mod_parsed_vars and
nginx_upstream_hash.

But,it doesn’t work correctly.

By the case,Japanese mobile phone doesn’t accept cookies.
So, I want to sticky with URL.

Environment is like this.
e$B!!!(#(!(!(!(!(!(!(!(!(((!(!(!(!(!(!(!(!(((!(!(!(!(!(!(!(!($e(B
e$B!!e(B e$B("e(B e$B!!e(B e$B!!e(B e$B("e(B e$B!!e(B
e$B!!e(B e$B("e(B e$B!!e(B e$B!!e(B e$B("e(B
e$B(#(!(!((!(!($!!!(#(!(!((!(!($!!!(#(!(!((!(!($!!!(#(!(!((!(!($e(B
e$B("e(B LB e$B("e(B e$B("e(B Web e$B("e(B e$B("e(B
Web e$B("e(B e$B("e(B Web e$B("e(B
e$B(&(!(!(!(!(!(%!!!(&(!(!(!(!(!(%!!!(&(!(!(!(!(!(%!!!(&(!(!(!(!(!(%e(B

Details are below.

OS:CentOS5.2
Package: nginx-0.6.31-3.el5.src.rpm
with mod_parsed_vars and nginx_upstream_hash patch.

Config:/etc/nginx/nginx.conf

user nginx;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 2048;
use epoll;
}

http {

include       /etc/nginx/mime.types;
default_type  application/octet-stream;
log_format  main  '$remote_addr - $remote_user [$time_local]

“$request” ’
'$status $body_bytes_sent “$http_referer” ’
‘"$http_user_agent"’;
access_log /var/log/nginx/access.log main;

# for session debug
log_format session '$remote_addr - [$time_local] $request '
             '$args_PHPSESSID' => $upstream_addr';
access_log  /var/log/nginx/session.log  session;

#############################################################3

www.zzzz.com

#############################################################3
upstream www {
server 1.1.1.1:80 max_fails=0 fail_timeout=2s;
server 2.2.2.2:80 max_fails=0 fail_timeout=2s;
server 3.3.3.3:80 max_fails=0 fail_timeout=2s;
hash $args_PHPSESSID;
}

server {
    listen 59.106.75.235:80;
    server_name 4.4.4.4;

    location / {
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_set_header  X-Forwarded-For 

$proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_read_timeout 5;
proxy_redirect false;
proxy_pass http://www;
}
}
}

Please help.

ryo sato ha scritto:

Hi.

I want to balance with URLSessionID like
http://zzzzz.com/index.php?PHPSESSID=XXXXXX
^^^^^^^^^^^^^^^^
So, I recompiled nginx-0.6.31 with mod_parsed_vars and nginx_upstream_hash.

Do you have applied the patch for Nginx, required by mod_parsed_vars?

But,it doesn’t work correctly.

What do you means by “doesn’t work correctly”?

[…]
log_format session ‘$remote_addr - [$time_local] $request ’
‘$args_PHPSESSID’ => $upstream_addr’;
access_log /var/log/nginx/session.log session;

Is the PHPSESSID correctly logged?

[…]

Manlio P.

Thank you for answering my question.

Do you have applied the patch for Nginx, required by mod_parsed_vars?

What patch is required by mod_parsed_vars?
To use mod_parsed_vars, any other patch is required?

My spec file is below.(atattched)


patch -p0 <
/%{_builddir}/nginx-%{version}/nginx_upstream_hash-0.2/nginx-0.5.21.patch
patch -p0 <
/%{_builddir}/nginx-%{version}/mod_parsed_vars-70df16b39e79/ngx_http_parsed_variables.patch

./configure

–add-module=%{_builddir}/nginx-%{version}/nginx_upstream_hash-0.2
–add-module=%{_builddir}/nginx-%{version}/mod_parsed_vars-70df16b39e79

When applying the patches,messages is like this.

  • patch -p0
    patching file src/http/ngx_http_upstream.h
    Hunk #1 succeeded at 90 with fuzz 1 (offset 1 line).
  • patch -p0
    patching file src/http/ngx_http_variables.c
    Hunk #1 succeeded at 1388 (offset 15 lines).
  • exit 0

    ===================================================

What do you means by “doesn’t work correctly”?

It seems that the sessionID is not substituted for the
variable($args_xxx).

But no error messages is displayed, when starting the daemon.

Is the PHPSESSID correctly logged?

No.
Always displayed “-”.

===================================================
1.1.1.1 - [09/Sep/2008:21:17:28 +0900] GET
/index.php?PHPSESSID=a430ccca204612b88ecff8647ea11152e9937f1d86a4b30db6e6d98b647dd752
HTTP/1.1 -=>-’

ryo sato ha scritto:

Thank you for answering my question.

Do you have applied the patch for Nginx, required by mod_parsed_vars?

What patch is required by mod_parsed_vars?

http://hg.mperillo.ath.cx/nginx/mod_parsed_vars/file/tip/ngx_http_parsed_variables.patch

This patch should be safe to use, but I have not tested it with recent
Nginx versions.

This patch is required so that Nginx will support “undeclared”
variables.

To use mod_parsed_vars, any other patch is required?

No.

[…]

Always displayed “-”.

“-” is displayed when the variable returns “not found”.

Manlio P.

Thank you for replying.

I tried entering URL directory.
Changing to a small letter,worked correct.

e$B(#(!(!(!(!(!(!(!(!(((!(!(!(!(!(!(!($e(B
e$B("e(Bvar e$B("e(BURL e$B("e(B
e$B(’(!(!(!(!(!(!(!(!(+(!(!(!(!(!(!(!()e(B
e$B("e(B$args_phpsessid e$B("e(Bphpsessid=xx e$B("e(BOK
e$B(’(!(!(!(!(!(!(!(!(+(!(!(!(!(!(!(!()e(B
e$B("e(B$args_phpsessid e$B("e(BPHPSESSID=xx e$B("e(BNG
e$B(’(!(!(!(!(!(!(!(!(+(!(!(!(!(!(!(!()e(B
e$B("e(B$args_PHPSESSID e$B("e(Bphpsessid=xx e$B("e(BOK
e$B(’(!(!(!(!(!(!(!(!(+(!(!(!(!(!(!(!()e(B
e$B("e(B$args_PHPSESSID e$B("e(BPHPSESSID=xx e$B("e(BNG
e$B(&(!(!(!(!(!(!(!(!(*(!(!(!(!(!(!(!(%e(B

So,I’ll modify php.ini.

This patch should be safe to use, but I have not tested it with recent
Nginx versions.

We can apply this patch on “Nginx-0.6.31”.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs