You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+51-48
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,13 @@
1
1
Nginx Sorted Querystring Module
2
2
===============================
3
3
4
-
A module to order the querystring parameters in a variable to be used as cache key.
4
+
This Nginx module orders the querystring parameters of an HTTP request alphanumerically and makes the sorted key-value pairs accessible using an Nginx variable.
5
5
6
-
Requests like /index.html?b=2&a=1&c=3, /index.html?b=2&c=3&a=1, /index.html?c=3&a=1&b=2, /index.html?c=3&b=2&a=1 will produce the same value for `$sorted_querystring_args`_'a=1&b=2&c=3'_.
6
+
Requests like `/index.html?b=2&a=1&c=3`, `/index.html?b=2&c=3&a=1`, `/index.html?c=3&a=1&b=2`, `/index.html?c=3&b=2&a=1` will produce the same normalized querystring `a=1&b=2&c=3` which can be accessed within Nginx using the `$sorted_querystring_args` variable.
7
7
8
-
It is also possible remove some undesired parameter defining its name with `sorted_querysting_filter_parameter`, like `sorted_querysting_filter_parameter b _ foo;` resulting in a `$sorted_querystring_args` as _'a=1&c=3'_
8
+
This is especially useful if you want to normalize the querystring to be used in a cache key, for example when used with the `proxy_cache_key` directive.
9
+
10
+
It is also possible to remove one or more undesired query parameters by defining their name with the `sorted_querysting_filter_parameter` directive, like `sorted_querystring_filter_parameter <parameter_name> [<parameter_name> <parameter_name> ...];`.
9
11
10
12
_This module is not distributed with the Nginx source. See [the installation instructions](#installation)._
11
13
@@ -15,68 +17,69 @@ Configuration
15
17
16
18
An example:
17
19
18
-
pid logs/nginx.pid;
19
-
error_log logs/nginx-main_error.log debug;
20
+
```
21
+
pid logs/nginx.pid;
22
+
error_log logs/nginx-main_error.log debug;
20
23
21
-
worker_processes 2;
24
+
worker_processes 2;
22
25
23
-
events {
24
-
worker_connections 1024;
25
-
#use kqueue; # MacOS
26
-
use epoll; # Linux
27
-
}
26
+
events {
27
+
worker_connections 1024;
28
+
#use kqueue; # MacOS
29
+
use epoll; # Linux
30
+
}
28
31
29
-
http {
30
-
default_type text/plain;
32
+
http {
33
+
default_type text/plain;
31
34
32
-
types {
33
-
text/html html;
34
-
}
35
+
types {
36
+
text/html html;
37
+
}
35
38
36
-
log_format main '[$time_local] $host "$request" $request_time s '
[Download Nginx Stable](http://nginx.org/en/download.html) source and uncompress it (ex.: to ../nginx). You must then run ./configure with --add-module pointing to this project as usual. Something in the lines of:
@@ -102,7 +105,7 @@ Directives
102
105
$ make install
103
106
104
107
105
-
Running tests
108
+
Running Tests
106
109
-------------
107
110
108
111
This project uses [nginx_test_helper](https://github.com/wandenberg/nginx_test_helper) on the test suite. So, after you've installed the module, you can just download the necessary gems:
0 commit comments