Opened 7 years ago

Closed 7 years ago

#1271 closed defect (wontfix)

$arg_s:event:id does not work

Reported by: rcosnita@… Owned by:
Priority: blocker Milestone:
Component: nginx-core Version: 1.10.x
Keywords: Cc:
uname -a: nginx version: nginx/1.10.3
nginx -V: Linux 327acafc16fa 4.9.13-moby #1 SMP Sat Mar 25 02:48:44 UTC 2017 x86_64 Linux

It is alpine linux in docker but the same behaviour can be easily reproduced in ubuntu / macos or centos.

Description

I try to set a variable in nginx configuration which holds the value of the query parameter: s:event:id. Unfortunately, it does not work. Below you can find a sample location from my configuration file:

location /test-error {

set $sid $arg_s:event:sid;

return 200 $sid;

}

sid variable holds :event:sid instead of the query parameter value. Below you can find a curl statement for testing this:

curl -v http://127.0.0.1:8080/test-error?s:event:sid=123x46xx

Change History (4)

comment:1 by rcosnita@…, 7 years ago

I've just reproduced the bug in the latest nginx relase: 1.13.0. The commit number I've used for building the nginx from is 0cb7be3c715fd6b85227610c654c9b8f6f7ae666.

comment:2 by rcosnita@…, 7 years ago

I know colon (:) is a reserved character but I think there are many cases where people are using it in the query parameter name (even though they shouldn't).

comment:3 by rcosnita@…, 7 years ago

Here is a possible workaround for the problem:

location /test-error {

set $sid "";

if ($args ~* "s:event:sid=(.*)[&]?") {

set $sid $1;

}

return 200 $sid;

}

comment:4 by Maxim Dounin, 7 years ago

Resolution: wontfix
Status: newclosed

Variable names in nginx can only include alphabetical characters, numbers, and "_" ([a-zA-Z0-9_]), so nginx sees $arg_s:event:sid in your example as the $arg_s variable and the :event:sid string. There are no plans to changes this. Using the $args variable if you want to access arguments with non-trivial names is a way to go.

Note: See TracTickets for help on using tickets.