{"id":13635827,"url":"https://github.com/openresty/set-misc-nginx-module","last_synced_at":"2025-04-19T04:31:30.257Z","repository":{"id":45495070,"uuid":"498791","full_name":"openresty/set-misc-nginx-module","owner":"openresty","description":"Various set_xxx directives added to nginx's rewrite module (md5/sha1, sql/json quoting, and many more)","archived":false,"fork":false,"pushed_at":"2023-11-23T11:42:20.000Z","size":481,"stargazers_count":382,"open_issues_count":16,"forks_count":102,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-02-13T09:09:34.053Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://wiki.nginx.org/NginxHttpSetMiscModule","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openresty.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2010-02-02T10:56:09.000Z","updated_at":"2023-12-28T19:08:07.000Z","dependencies_parsed_at":"2023-11-23T12:31:14.919Z","dependency_job_id":"3af361ee-b3d2-4919-a777-899012dba128","html_url":"https://github.com/openresty/set-misc-nginx-module","commit_stats":{"total_commits":240,"total_committers":23,"mean_commits":"10.434782608695652","dds":0.1958333333333333,"last_synced_commit":"3ea21393340a22a6a4dc3f9c1e07b3aac26a5c56"},"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fset-misc-nginx-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fset-misc-nginx-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fset-misc-nginx-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fset-misc-nginx-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openresty","download_url":"https://codeload.github.com/openresty/set-misc-nginx-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249606357,"owners_count":21298851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T00:00:52.597Z","updated_at":"2025-04-19T04:31:29.921Z","avatar_url":"https://github.com/openresty.png","language":"C","funding_links":[],"categories":["Modules","Third Modules","Third Party Modules","C","Lua and OpenResty ecosystem"],"sub_categories":["C Modules"],"readme":"\u003c!---\nDon't edit this file manually! Instead you should generate it by using:\n    wiki2markdown.pl doc/HttpSetMiscModule.wiki\n--\u003e\n\nName\n====\n\n**ngx_set_misc** - Various set_xxx directives added to nginx's rewrite module (md5/sha1, sql/json quoting, and many more)\n\n*This module is not distributed with the Nginx source.* See [the installation instructions](#installation).\n\nTable of Contents\n=================\n\n* [Name](#name)\n* [Version](#version)\n* [Synopsis](#synopsis)\n* [Description](#description)\n* [Directives](#directives)\n    * [set_if_empty](#set_if_empty)\n    * [set_quote_sql_str](#set_quote_sql_str)\n    * [set_quote_pgsql_str](#set_quote_pgsql_str)\n    * [set_quote_json_str](#set_quote_json_str)\n    * [set_unescape_uri](#set_unescape_uri)\n    * [set_escape_uri](#set_escape_uri)\n    * [set_hashed_upstream](#set_hashed_upstream)\n    * [set_encode_base32](#set_encode_base32)\n    * [set_base32_padding](#set_base32_padding)\n    * [set_misc_base32_padding](#set_misc_base32_padding)\n    * [set_base32_alphabet](#set_base32_alphabet)\n    * [set_decode_base32](#set_decode_base32)\n    * [set_encode_base64](#set_encode_base64)\n    * [set_decode_base64](#set_decode_base64)\n    * [set_encode_base64url](#set_encode_base64url)\n    * [set_decode_base64url](#set_decode_base64url)\n    * [set_encode_hex](#set_encode_hex)\n    * [set_decode_hex](#set_decode_hex)\n    * [set_sha1](#set_sha1)\n    * [set_md5](#set_md5)\n    * [set_hmac_sha1](#set_hmac_sha1)\n    * [set_hmac_sha256](#set_hmac_sha256)\n    * [set_random](#set_random)\n    * [set_secure_random_alphanum](#set_secure_random_alphanum)\n    * [set_secure_random_lcalpha](#set_secure_random_lcalpha)\n    * [set_rotate](#set_rotate)\n    * [set_local_today](#set_local_today)\n    * [set_formatted_gmt_time](#set_formatted_gmt_time)\n    * [set_formatted_local_time](#set_formatted_local_time)\n* [Caveats](#caveats)\n* [Installation](#installation)\n    * [Building as a dynamic module](#building-as-a-dynamic-module)\n* [Compatibility](#compatibility)\n* [Report Bugs](#report-bugs)\n* [Source Repository](#source-repository)\n* [Changes](#changes)\n* [Test Suite](#test-suite)\n* [Getting involved](#getting-involved)\n* [Author](#author)\n* [Copyright \u0026 License](#copyright--license)\n* [See Also](#see-also)\n\nVersion\n=======\n\nThis document describes ngx_set_misc [v0.32](https://github.com/openresty/set-misc-nginx-module/tags) released on 19 April 2018.\n\nSynopsis\n========\n\n```nginx\n\n location /foo {\n     set $a $arg_a;\n     set_if_empty $a 56;\n\n     # GET /foo?a=32 will yield $a == 32\n     # while GET /foo and GET /foo?a= will\n     # yeild $a == 56 here.\n }\n\n location /bar {\n     set $foo \"hello\\n\\n'\\\"\\\\\";\n     set_quote_sql_str $foo $foo; # for mysql\n\n     # OR in-place editing:\n     #   set_quote_sql_str $foo;\n\n     # now $foo is: 'hello\\n\\n\\'\\\"\\\\'\n }\n\n location /bar {\n     set $foo \"hello\\n\\n'\\\"\\\\\";\n     set_quote_pgsql_str $foo;  # for PostgreSQL\n\n     # now $foo is: E'hello\\n\\n\\'\\\"\\\\'\n }\n\n location /json {\n     set $foo \"hello\\n\\n'\\\"\\\\\";\n     set_quote_json_str $foo $foo;\n\n     # OR in-place editing:\n     #   set_quote_json_str $foo;\n\n     # now $foo is: \"hello\\n\\n'\\\"\\\\\"\n }\n\n location /baz {\n     set $foo \"hello%20world\";\n     set_unescape_uri $foo $foo;\n\n     # OR in-place editing:\n     #   set_unescape_uri $foo;\n\n     # now $foo is: hello world\n }\n\n upstream_list universe moon sun earth;\n upstream moon { ... }\n upstream sun { ... }\n upstream earth { ... }\n location /foo {\n     set_hashed_upstream $backend universe $arg_id;\n     drizzle_pass $backend; # used with ngx_drizzle\n }\n\n location /base32 {\n     set $a 'abcde';\n     set_encode_base32 $a;\n     set_decode_base32 $b $a;\n\n     # now $a == 'c5h66p35' and\n     # $b == 'abcde'\n }\n\n location /base64 {\n     set $a 'abcde';\n     set_encode_base64 $a;\n     set_decode_base64 $b $a;\n\n     # now $a == 'YWJjZGU=' and\n     # $b == 'abcde'\n }\n\n location /hex {\n     set $a 'abcde';\n     set_encode_hex $a;\n     set_decode_hex $b $a;\n\n     # now $a == '6162636465' and\n     # $b == 'abcde'\n }\n\n # GET /sha1 yields the output\n #   aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d\n location /sha1 {\n     set_sha1 $a hello;\n     echo $a;\n }\n\n # ditto\n location /sha1 {\n     set $a hello;\n     set_sha1 $a;\n     echo $a;\n }\n\n # GET /today yields the date of today in local time using format 'yyyy-mm-dd'\n location /today {\n     set_local_today $today;\n     echo $today;\n }\n\n # GET /signature yields the hmac-sha-1 signature\n # given a secret and a string to sign\n # this example yields the base64 encoded singature which is\n # \"HkADYytcoQQzqbjQX33k/ZBB/DQ=\"\n location /signature {\n     set $secret_key 'secret-key';\n     set $string_to_sign \"some-string-to-sign\";\n     set_hmac_sha1 $signature $secret_key $string_to_sign;\n     set_encode_base64 $signature $signature;\n     echo $signature;\n }\n\n location = /rand {\n     set $from 3;\n     set $to 15;\n     set_random $rand $from $to;\n\n     # or write directly\n     #   set_random $rand 3 15;\n\n     echo $rand;  # will print a random integer in the range [3, 15]\n }\n```\n\nDescription\n===========\n\nThis module extends the standard HttpRewriteModule's directive set to provide more functionalities like URI escaping and unescaping, JSON quoting, Hexadecimal/MD5/SHA1/Base32/Base64 digest encoding and decoding, random number generator, and more!\n\nEvery directive provided by this module can be mixed freely with other [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s directives, like [if](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if) and [set](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#set). (Thanks to the [Nginx Devel Kit](https://github.com/simpl/ngx_devel_kit)!)\n\n[Back to TOC](#table-of-contents)\n\nDirectives\n==========\n\n[Back to TOC](#table-of-contents)\n\nset_if_empty\n------------\n**syntax:** *set_if_empty $dst \u0026lt;src\u0026gt;*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nAssign the value of the argument `\u003csrc\u003e` if and only if variable `$dst` is empty (i.e., not found or has an empty string value).\n\nIn the following example,\n\n```nginx\n\n set $a 32;\n set_if_empty $a 56;\n```\n\nthe variable `$dst` will take the value 32 at last. But in the sample\n\n```nginx\n\n set $a '';\n set $value \"hello, world\"\n set_if_empty $a $value;\n```\n\n`$a` will take the value `\"hello, world\"` at last.\n\n[Back to TOC](#table-of-contents)\n\nset_quote_sql_str\n-----------------\n**syntax:** *set_quote_sql_str $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_quote_sql_str $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nWhen taking two arguments, this directive will quote the value of the second argument `\u003csrc\u003e` by MySQL's string value quoting rule and assign the result into the first argument, variable `$dst`. For example,\n\n```nginx\n\n location /test {\n     set $value \"hello\\n\\r'\\\"\\\\\";\n     set_quote_sql_str $quoted $value;\n\n     echo $quoted;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n```sql\n\n 'hello\\n\\r\\'\\\"\\\\'\n```\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nWhen taking a single argument, this directive will do in-place modification of the argument variable. For example,\n\n```nginx\n\n location /test {\n     set $value \"hello\\n\\r'\\\"\\\\\";\n     set_quote_sql_str $value;\n\n     echo $value;\n }\n```\n\nthen request `GET /test` will give exactly the same output as the previous example.\n\nThis directive is usually used to prevent SQL injection.\n\nThis directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive.\n\n[Back to TOC](#table-of-contents)\n\nset_quote_pgsql_str\n-------------------\n**syntax:** *set_quote_pgsql_str $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_quote_pgsql_str $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nVery much like [set_quote_sql_str](#set_quote_sql_str), but with PostgreSQL quoting rules for SQL string literals.\n\n[Back to TOC](#table-of-contents)\n\nset_quote_json_str\n------------------\n**syntax:** *set_quote_json_str $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_quote_json_str $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nWhen taking two arguments, this directive will quote the value of the second argument `\u003csrc\u003e` by JSON string value quoting rule and assign the result into the first argument, variable `$dst`. For example,\n\n```nginx\n\n location /test {\n     set $value \"hello\\n\\r'\\\"\\\\\";\n     set_quote_json_str $quoted $value;\n\n     echo $quoted;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n```javascript\n\n \"hello\\n\\r'\\\"\\\\\"\n```\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nWhen taking a single argument, this directive will do in-place modification of the argument variable. For example,\n\n```nginx\n\n location /test {\n     set $value \"hello\\n\\r'\\\"\\\\\";\n     set_quote_json_str $value;\n\n     echo $value;\n }\n```\n\nthen request `GET /test` will give exactly the same output as the previous example.\n\nThis directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive.\n\n[Back to TOC](#table-of-contents)\n\nset_unescape_uri\n----------------\n**syntax:** *set_unescape_uri $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_unescape_uri $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nWhen taking two arguments, this directive will unescape the value of the second argument `\u003csrc\u003e` as a URI component and assign the result into the first argument, variable `$dst`. For example,\n\n```nginx\n\n location /test {\n     set_unescape_uri $key $arg_key;\n     echo $key;\n }\n```\n\nThen request `GET /test?key=hello+world%21` will yield the following output\n\n```\nhello world!\n```\n\nThe nginx standard [$arg_PARAMETER](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_arg_) variable holds the raw (escaped) value of the URI parameter. So we need the `set_unescape_uri` directive to unescape it first.\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nWhen taking a single argument, this directive will do in-place modification of the argument variable. For example,\n\n```nginx\n\n location /test {\n     set $key $arg_key;\n     set_unescape_uri $key;\n\n     echo $key;\n }\n```\n\nthen request `GET /test?key=hello+world%21` will give exactly the same output as the previous example.\n\nThis directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive.\n\n[Back to TOC](#table-of-contents)\n\nset_escape_uri\n--------------\n**syntax:** *set_escape_uri $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_escape_uri $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nVery much like the [set_unescape_uri](#set_unescape_uri) directive, but does the conversion the other way around, i.e., URL component escaping.\n\n[Back to TOC](#table-of-contents)\n\nset_hashed_upstream\n-------------------\n**syntax:** *set_hashed_upstream $dst \u0026lt;upstream_list_name\u0026gt; \u0026lt;src\u0026gt;*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nHashes the string argument `\u003csrc\u003e` into one of the upstream name included in the upstream list named `\u003cupstream_list_name\u003e`. The hash function being used is simple modulo.\n\nHere's an example,\n\n```nginx\n\n upstream moon { ... }\n upstream sun { ... }\n upstream earth { ... }\n\n upstream_list universe moon sun earth;\n\n location /test {\n     set_unescape_uri $key $arg_key;\n     set $list_name universe;\n     set_hashed_upstream $backend $list_name $key;\n\n     echo $backend;\n }\n```\n\nThen `GET /test?key=blah` will output either \"moon\", \"sun\", or \"earth\", depending on the actual value of the `key` query argument.\n\nThis directive is usually used to compute an nginx variable to be passed to [memc-nginx-module](http://github.com/openresty/memc-nginx-module)'s [memc_pass](http://github.com/openresty/memc-nginx-module#memc_pass) directive, [redis2-nginx-module](http://github.com/openresty/redis2-nginx-module)'s [[HttpRedis2Module#redis2_pass]] directive, and [ngx_http_proxy_module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html)'s [proxy_pass](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass) directive, among others.\n\n[Back to TOC](#table-of-contents)\n\nset_encode_base32\n-----------------\n**syntax:** *set_encode_base32 $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_encode_base32 $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nWhen taking two arguments, this directive will encode the value of the second argument `\u003csrc\u003e` to its base32(hex) digest and assign the result into the first argument, variable `$dst`. For example,\n\n```nginx\n\n location /test {\n     set $raw \"abcde\";\n     set_encode_base32 $digest $raw;\n\n     echo $digest;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n```\nc5h66p35\n```\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nRFC forces the `[A-Z2-7]` RFC-3548 compliant encoding, but we are using the \"base32hex\" encoding (`[0-9a-v]`) by default. The [set_base32_alphabet](#set_base32_alphabet) directive (first introduced in `v0.28`) allows you to change the alphabet used for encoding/decoding so RFC-3548 compliant encoding is still possible by custom configurations.\n\nBy default, the `=` character is used to pad the left-over bytes due to alignment. But the padding behavior can be completely disabled by setting [set_base32_padding](#set_base32_padding) `off`.\n\nWhen taking a single argument, this directive will do in-place modification of the argument variable. For example,\n\n```nginx\n\n location /test {\n     set $value \"abcde\";\n     set_encode_base32 $value;\n\n     echo $value;\n }\n```\n\nthen request `GET /test` will give exactly the same output as the previous example.\n\nThis directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive.\n\n[Back to TOC](#table-of-contents)\n\nset_base32_padding\n------------------\n**syntax:** *set_base32_padding on|off*\n\n**default:** *on*\n\n**context:** *http, server, server if, location, location if*\n\n**phase:** *no*\n\nThis directive can control whether to pad left-over bytes with the \"=\" character when encoding a base32 digest by the\n[set_encode_base32](#set_encode_base32) directive.\n\nThis directive was first introduced in `v0.28`. If you use earlier versions of this module, then you should use [set_misc_base32_padding](#set_misc_base32_padding) instead.\n\n[Back to TOC](#table-of-contents)\n\nset_misc_base32_padding\n-----------------------\n**syntax:** *set_misc_base32_padding on|off*\n\n**default:** *on*\n\n**context:** *http, server, server if, location, location if*\n\n**phase:** *no*\n\nThis directive has been deprecated since `v0.28`. Use [set_base32_padding](#set_base32_padding) instead if you are using `v0.28+`.\n\n[Back to TOC](#table-of-contents)\n\nset_base32_alphabet\n-------------------\n**syntax:** *set_base32_alphabet \u0026lt;alphabet\u0026gt;*\n\n**default:** *\"0123456789abcdefghijklmnopqrstuv\"*\n\n**context:** *http, server, server if, location, location if*\n\n**phase:** *no*\n\nThis directive controls the alphabet used for encoding/decoding a base32 digest. It accepts a string containing the desired alphabet like \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\" for standard alphabet.\n\nExtended (base32hex) alphabet is used by default.\n\nThis directive was first introduced in `v0.28`.\n\n[Back to TOC](#table-of-contents)\n\nset_decode_base32\n-----------------\n**syntax:** *set_decode_base32 $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_decode_base32 $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nSimilar to the [set_encode_base32](#set_encode_base32) directive, but does exactly the opposite operation, .i.e, decoding a base32(hex) digest into its original form.\n\n[Back to TOC](#table-of-contents)\n\nset_encode_base64\n-----------------\n**syntax:** *set_encode_base64 $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_encode_base64 $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nWhen taking two arguments, this directive will encode the value of the second argument `\u003csrc\u003e` to its base64 digest and assign the result into the first argument, variable `$dst`. For example,\n\n```nginx\n\n location /test {\n     set $raw \"abcde\";\n     set_encode_base64 $digest $raw;\n\n     echo $digest;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n```\nYWJjZGU=\n```\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nWhen taking a single argument, this directive will do in-place modification of the argument variable. For example,\n\n```nginx\n\n location /test {\n     set $value \"abcde\";\n     set_encode_base64 $value;\n\n     echo $value;\n }\n```\n\nthen request `GET /test` will give exactly the same output as the previous example.\n\nThis directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive.\n\n[Back to TOC](#table-of-contents)\n\nset_encode_base64url\n-----------------\n**syntax:** *set_encode_base64url $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_encode_base64url $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nWhen taking two arguments, this directive will encode the value of the second argument `\u003csrc\u003e` to its base64 url safe digest and assign the result into the first argument, variable `$dst`. For example,\n\n```nginx\n\n location /test {\n     set $raw \"abcde\";\n     set_encode_base64url $digest $raw;\n\n     echo $digest;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n```\nYWJjZGU=\n```\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nWhen taking a single argument, this directive will do in-place modification of the argument variable. For example,\n\n```nginx\n\n location /test {\n     set $value \"abcde\";\n     set_encode_base64url $value;\n\n     echo $value;\n }\n```\n\nthen request `GET /test` will give exactly the same output as the previous example.\n\nThis directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive.\n\n[Back to TOC](#table-of-contents)\n\nset_decode_base64\n-----------------\n**syntax:** *set_decode_base64 $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_decode_base64 $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nSimilar to the [set_encode_base64](#set_encode_base64) directive, but does exactly the opposite operation, .i.e, decoding a base64 digest into its original form.\n\n[Back to TOC](#table-of-contents)\n\nset_decode_base64url\n-----------------\n**syntax:** *set_decode_base64url $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_decode_base64url $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nSimilar to the [set_encode_base64url](#set_encode_base64url) directive, but does exactly the the opposite operation, .i.e, decoding a base64 url safe digest into its original form.\n\n[Back to TOC](#table-of-contents)\n\nset_encode_hex\n--------------\n**syntax:** *set_encode_hex $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_encode_hex $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nWhen taking two arguments, this directive will encode the value of the second argument `\u003csrc\u003e` to its hexadecimal digest and assign the result into the first argument, variable `$dst`. For example,\n\n```nginx\n\n location /test {\n     set $raw \"章亦春\";\n     set_encode_hex $digest $raw;\n\n     echo $digest;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n```\ne7aba0e4baa6e698a5\n```\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nWhen taking a single argument, this directive will do in-place modification of the argument variable. For example,\n\n```nginx\n\n location /test {\n     set $value \"章亦春\";\n     set_encode_hex $value;\n\n     echo $value;\n }\n```\n\nthen request `GET /test` will give exactly the same output as the previous example.\n\nThis directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive.\n\n[Back to TOC](#table-of-contents)\n\nset_decode_hex\n--------------\n**syntax:** *set_decode_hex $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_decode_hex $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nSimilar to the [set_encode_hex](#set_encode_hex) directive, but does exactly the opposite operation, .i.e, decoding a hexadecimal digest into its original form.\n\n[Back to TOC](#table-of-contents)\n\nset_sha1\n--------\n**syntax:** *set_sha1 $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_sha1 $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nWhen taking two arguments, this directive will encode the value of the second argument `\u003csrc\u003e` to its [SHA-1](http://en.wikipedia.org/wiki/SHA-1) digest and assign the result into the first argument, variable `$dst`. The hexadecimal form of the `SHA-1` digest will be generated automatically, use [set_decode_hex](#set_decode_hex) to decode the result if you want the binary form of the `SHA-1` digest.\n\nFor example,\n\n```nginx\n\n location /test {\n     set $raw \"hello\";\n     set_sha1 $digest $raw;\n\n     echo $digest;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n```\naaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d\n```\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nWhen taking a single argument, this directive will do in-place modification of the argument variable. For example,\n\n```nginx\n\n location /test {\n     set $value \"hello\";\n     set_sha1 $value;\n\n     echo $value;\n }\n```\n\nthen request `GET /test` will give exactly the same output as the previous example.\n\nThis directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive.\n\n[Back to TOC](#table-of-contents)\n\nset_md5\n-------\n**syntax:** *set_md5 $dst \u0026lt;src\u0026gt;*\n\n**syntax:** *set_md5 $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\n**category:** *ndk_set_var_value*\n\nWhen taking two arguments, this directive will encode the value of the second argument `\u003csrc\u003e` to its [MD5](http://en.wikipedia.org/wiki/MD5) digest and assign the result into the first argument, variable `$dst`. The hexadecimal form of the `MD5` digest will be generated automatically, use [set_decode_hex](#set_decode_hex) to decode the result if you want the binary form of the `MD5` digest.\n\nFor example,\n\n```nginx\n\n location /test {\n     set $raw \"hello\";\n     set_md5 $digest $raw;\n\n     echo $digest;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n\n    5d41402abc4b2a76b9719d911017c592\n\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nWhen taking a single argument, this directive will do in-place modification of the argument variable. For example,\n\n```nginx\n\n location /test {\n     set $value \"hello\";\n     set_md5 $value;\n\n     echo $value;\n }\n```\n\nthen request `GET /test` will give exactly the same output as the previous example.\n\nThis directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive.\n\n[Back to TOC](#table-of-contents)\n\nset_hmac_sha1\n-------------\n**syntax:** *set_hmac_sha1 $dst \u0026lt;secret_key\u0026gt; \u0026lt;src\u0026gt;*\n\n**syntax:** *set_hmac_sha1 $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nComputes the [HMAC-SHA1](http://en.wikipedia.org/wiki/HMAC) digest of the argument `\u003csrc\u003e` and assigns the result into the argument variable `$dst` with the secret key `\u003csecret_key\u003e`.\n\nThe raw binary form of the `HMAC-SHA1` digest will be generated, use [set_encode_base64](#set_encode_base64), for example, to encode the result to a textual representation if desired.\n\nFor example,\n\n```nginx\n\n location /test {\n     set $secret 'thisisverysecretstuff';\n     set $string_to_sign 'some string we want to sign';\n     set_hmac_sha1 $signature $secret $string_to_sign;\n     set_encode_base64 $signature $signature;\n     echo $signature;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n```\nR/pvxzHC4NLtj7S+kXFg/NePTmk=\n```\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nThis directive requires the OpenSSL library enabled in your Nginx build (usually by passing the `--with-http_ssl_module` option to the `./configure` script).\n\n[Back to TOC](#table-of-contents)\n\nset_hmac_sha256\n---------------\n**syntax:** *set_hmac_sha256 $dst \u0026lt;secret_key\u0026gt; \u0026lt;src\u0026gt;*\n\n**syntax:** *set_hmac_sha256 $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nComputes the [HMAC-SHA256](http://en.wikipedia.org/wiki/HMAC) digest of the argument `\u003csrc\u003e` and assigns the result into the argument variable `$dst` with the secret key `\u003csecret_key\u003e`.\n\nThe raw binary form of the `HMAC-SHA256` digest will be generated, use [set_encode_base64](#set_encode_base64), for example, to encode the result to a textual representation if desired.\n\nFor example,\n\n```nginx\n\n location /test {\n     set $secret 'thisisverysecretstuff';\n     set $string_to_sign 'some string we want to sign';\n     set_hmac_sha256 $signature $secret $string_to_sign;\n     set_encode_base64 $signature $signature;\n     echo $signature;\n }\n```\n\nThen request `GET /test` will yield the following output\n\n```\n4pU3GRQrKKIoeLb9CqYsavHE2l6Hx+KMmRmesU+Cfrs=\n```\n\nPlease note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly.\n\nThis directive requires the OpenSSL library enabled in your Nginx build (usually by passing the `--with-http_ssl_module` option to the `./configure` script).\n\n[Back to TOC](#table-of-contents)\n\nset_random\n----------\n**syntax:** *set_random $res \u0026lt;from\u0026gt; \u0026lt;to\u0026gt;*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nGenerates a (pseudo) random number (in textual form) within the range `[\u003c$from\u003e, \u003c$to\u003e]` (inclusive).\n\nOnly non-negative numbers are allowed for the `\u003cfrom\u003e` and `\u003cto\u003e` arguments.\n\nWhen `\u003cfrom\u003e` is greater than `\u003cto\u003e`, their values will be exchanged accordingly.\n\nFor instance,\n\n```nginx\n\n location /test {\n     set $from 5;\n     set $to 7;\n     set_random $res $from $to;\n\n     echo $res;\n }\n```\n\nthen request `GET /test` will output a number between 5 and 7 (i.e., among 5, 6, 7).\n\nFor now, there's no way to configure a custom random generator seed.\n\nBehind the scene, it makes use of the standard C function `rand()`.\n\nThis directive was first introduced in the `v0.22rc1` release.\n\nSee also [set_secure_random_alphanum](#set_secure_random_alphanum) and [set_secure_random_lcalpha](#set_secure_random_lcalpha).\n\n[Back to TOC](#table-of-contents)\n\nset_secure_random_alphanum\n--------------------------\n**syntax:** *set_secure_random_alphanum $res \u0026lt;length\u0026gt;*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nGenerates a cryptographically-strong random string `\u003clength\u003e` characters long with the alphabet `[a-zA-Z0-9]`.\n\n`\u003clength\u003e` may be between 1 and 64, inclusive.\n\nFor instance,\n\n```nginx\n\n location /test {\n     set_secure_random_alphanum $res 32;\n\n     echo $res;\n }\n```\n\nthen request `GET /test` will output a string like `ivVVRP2DGaAqDmdf3Rv4ZDJ7k0gOfASz`.\n\nThis functionality depends on the presence of the `/dev/urandom` device, available on most UNIX-like systems.\n\nSee also [set_secure_random_lcalpha](#set_secure_random_lcalpha) and [set_random](#set_random).\n\nThis directive was first introduced in the `v0.22rc8` release.\n\n[Back to TOC](#table-of-contents)\n\nset_secure_random_lcalpha\n-------------------------\n**syntax:** *set_secure_random_lcalpha $res \u0026lt;length\u0026gt;*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nGenerates a cryptographically-strong random string `\u003clength\u003e` characters long with the alphabet `[a-z]`.\n\n`\u003clength\u003e` may be between 1 and 64, inclusive.\n\nFor instance,\n\n```nginx\n\n location /test {\n     set_secure_random_lcalpha $res 32;\n\n     echo $res;\n }\n```\n\nthen request `GET /test` will output a string like `kcuxcddktffsippuekhshdaclaquiusj`.\n\nThis functionality depends on the presence of the `/dev/urandom` device, available on most UNIX-like systems.\n\nThis directive was first introduced in the `v0.22rc8` release.\n\nSee also [set_secure_random_alphanum](#set_secure_random_alphanum) and [set_random](#set_random).\n\n[Back to TOC](#table-of-contents)\n\nset_rotate\n----------\n**syntax:** *set_rotate $value \u0026lt;from\u0026gt; \u0026lt;to\u0026gt;*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nIncrements `$value` but keeps it in range from `\u003cfrom\u003e` to `\u003cto\u003e`. \nIf `$value` is greater than `\u003cto\u003e` or less than `\u003cfrom\u003e` it will be \nset to `\u003cfrom\u003e` value.\n\nThe current value after running this directive will always be saved on a per-location basis. And then this saved value will be used for incrementation when the `$value` is not initialized or has a bad value.\n\nOnly non-negative numbers are allowed for the `\u003cfrom\u003e` and `\u003cto\u003e` arguments.\n\nWhen `\u003cfrom\u003e` is greater than `\u003cto\u003e`, their values will be exchanged accordingly.\n\nFor instance,\n\n```nginx\n\n location /rotate {\n     default_type text/plain;\n     set $counter $cookie_counter;\n     set_rotate $counter 1 5;\n     echo $counter;\n     add_header Set-Cookie counter=$counter;\n }\n```\n\nthen request `GET /rotate` will output next number between 1 and 5 (i.e., 1, 2, 3, 4, 5) on each\nrefresh of the page. This directive may be userful for banner rotation purposes.\n\nAnother example is to use server-side value persistence to do simple round-robin:\n\n```nginx\n\n location /rotate {\n     default_type text/plain;\n     set_rotate $counter 0 3;\n     echo $counter;\n }\n```\n\nAnd accessing `/rotate` will also output integer sequence 0, 1, 2, 3, 0, 1, 2, 3, and so on.\n\nThis directive was first introduced in the `v0.22rc7` release.\n\n[Back to TOC](#table-of-contents)\n\nset_local_today\n---------------\n**syntax:** *set_local_today $dst*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nSet today's date (\"yyyy-mm-dd\") in localtime to the argument variable `$dst`.\n\nHere's an example,\n\n```nginx\n\n location /today {\n     set_local_today $today;\n     echo $today;\n }\n```\n\nthen request `GET /today` will output something like\n\n```\n2011-08-16\n```\n\nand yeah, the actual date you get here will vary every day ;)\n\nBehind the scene, this directive utilizes the `ngx_time` API in the Nginx core, so usually no syscall is involved due to the time caching mechanism in the Nginx core.\n\n[Back to TOC](#table-of-contents)\n\nset_formatted_gmt_time\n----------------------\n**syntax:** *set_formatted_gmt_time $res \u0026lt;time-format\u0026gt;*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nSet a formatted GMT time to variable `$res` (as the first argument) using the format string in the second argument.\n\nAll the conversion specification notations in the standard C function `strftime` are supported, like `%Y` (for 4-digit years) and `%M` (for minutes in decimal). See \u003chttp://linux.die.net/man/3/strftime\u003e for a complete list of conversion specification symbols.\n\nBelow is an example:\n\n```nginx\n\n location = /t {\n     set_formatted_gmt_time $timestr \"%a %b %e %H:%M:%S %Y GMT\";\n     echo $timestr;\n }\n```\n\nAccessing `/t` yields the output\n\n```\nFri Dec 13 15:34:37 2013 GMT\n```\n\nThis directive was first added in the `0.23` release.\n\nSee also [set_formatted_local_time](#set_formatted_local_time).\n\n[Back to TOC](#table-of-contents)\n\nset_formatted_local_time\n------------------------\n**syntax:** *set_formatted_local_time $res \u0026lt;time-format\u0026gt;*\n\n**default:** *no*\n\n**context:** *location, location if*\n\n**phase:** *rewrite*\n\nSet a formatted local time to variable `$res` (as the first argument) using the format string in the second argument.\n\nAll the conversion specification notations in the standard C function `strftime` are supported, like `%Y` (for 4-digit years) and `%M` (for minutes in decimal). See \u003chttp://linux.die.net/man/3/strftime\u003e for a complete list of conversion specification symbols.\n\nBelow is an example:\n\n```nginx\n\n location = /t {\n     set_formatted_local_time $timestr \"%a %b %e %H:%M:%S %Y %Z\";\n     echo $timestr;\n }\n```\n\nAccessing `/t` yields the output\n\n```\nFri Dec 13 15:42:15 2013 PST\n```\n\nThis directive was first added in the `0.23` release.\n\nSee also [set_formatted_gmt_time](#set_formatted_gmt_time).\n\n[Back to TOC](#table-of-contents)\n\nCaveats\n=======\n\nDo not use [$arg_PARAMETER](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_arg_), [$cookie_COOKIE](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_cookie_), [$http_HEADER](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_) or other special variables defined in the Nginx core module as the target variable in this module's directives. For instance,\n\n```nginx\n\n set_if_empty $arg_user 'foo';  # DO NOT USE THIS!\n```\n\nmay lead to segmentation faults.\n\n[Back to TOC](#table-of-contents)\n\nInstallation\n============\n\nThis module is included and enabled by default in the [OpenResty bundle](http://openresty.org). If you want to install this module manually with your own Nginx source tarball, then follow the steps below:\n\nGrab the nginx source code from [nginx.org](http://nginx.org/), for example,\nthe version 1.13.6 (see [nginx compatibility](#compatibility)), and then build the source with this module:\n\n```bash\n\n wget 'http://nginx.org/download/nginx-1.13.6.tar.gz'\n tar -xzvf nginx-1.13.6.tar.gz\n cd nginx-1.13.6/\n\n # Here we assume you would install you nginx under /opt/nginx/.\n ./configure --prefix=/opt/nginx \\\n     --with-http_ssl_module \\\n     --add-module=/path/to/ngx_devel_kit \\\n     --add-module=/path/to/set-misc-nginx-module\n\n make -j2\n make install\n```\n\nDownload the latest version of the release tarball of this module from [set-misc-nginx-module file list](http://github.com/openresty/set-misc-nginx-module/tags), and the latest tarball for [ngx_devel_kit](https://github.com/simplresty/ngx_devel_kit) from its [file list](https://github.com/simplresty/ngx_devel_kit/tags).\n\n[Back to TOC](#table-of-contents)\n\nBuilding as a dynamic module\n----------------------------\n\nStarting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the\n`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module)\ndirective, for example,\n\n```nginx\nload_module /path/to/modules/ndk_http_module.so;  # assuming NDK is built as a dynamic module too\nload_module /path/to/modules/ngx_http_set_misc_module.so;\n```\n\nAlso, this module is included and enabled by default in the [OpenResty bundle](http://openresty.org/).\n\n[Back to TOC](#table-of-contents)\n\nCompatibility\n=============\n\nThe following versions of Nginx should work with this module:\n\n* **1.13.x**                      (last tested: 1.13.6)\n* **1.12.x**\n* **1.11.x**                      (last tested: 1.11.2)\n* **1.10.x**\n* **1.9.x**                       (last tested: 1.9.15)\n* **1.8.x**\n* **1.7.x**                       (last tested: 1.7.10)\n* **1.6.x**\n* **1.5.x**                       (last tested: 1.5.8)\n* **1.4.x**                       (last tested: 1.4.4)\n* **1.2.x**                       (last tested: 1.2.9)\n* **1.1.x**                       (last tested: 1.1.5)\n* **1.0.x**                       (last tested: 1.0.15)\n* **0.9.x**                       (last tested: 0.9.4)\n* **0.8.x**                       (last tested: 0.8.54)\n* **0.7.x \u003e= 0.7.46**             (last tested: 0.7.68)\n\nIf you find that any particular version of Nginx above 0.7.46 does not work with this module, please consider [reporting a bug](#report-bugs).\n\n[Back to TOC](#table-of-contents)\n\nReport Bugs\n===========\n\nAlthough a lot of effort has been put into testing and code tuning, there must be some serious bugs lurking somewhere in this module. So whenever you are bitten by any quirks, please don't hesitate to\n\n1. send a bug report or even patches to the [openresty-en mailing list](https://groups.google.com/group/openresty-en),\n1. or create a ticket on the [issue tracking interface](http://github.com/openresty/set-misc-nginx-module/issues) provided by GitHub.\n\n[Back to TOC](#table-of-contents)\n\nSource Repository\n=================\n\nAvailable on github at [openresty/set-misc-nginx-module](http://github.com/openresty/set-misc-nginx-module).\n\n[Back to TOC](#table-of-contents)\n\nChanges\n=======\n\nThe change logs for every release of this module can be obtained from the OpenResty bundle's change logs:\n\n\u003chttp://openresty.org/#Changes\u003e\n\n[Back to TOC](#table-of-contents)\n\nTest Suite\n==========\n\nThis module comes with a Perl-driven test suite. The [test cases](http://github.com/openresty/set-misc-nginx-module/tree/master/t/) are\n[declarative](http://github.com/openresty/set-misc-nginx-module/blob/master/t/escape-uri.t) too. Thanks to the [Test::Nginx](http://search.cpan.org/perldoc?Test::Nginx) module in the Perl world.\n\nTo run it on your side:\n\n```bash\n\n $ PATH=/path/to/your/nginx-with-set-misc-module:$PATH prove -r t\n```\n\nYou need to terminate any Nginx processes before running the test suite if you have changed the Nginx server binary.\n\nBecause a single nginx server (by default, `localhost:1984`) is used across all the test scripts (`.t` files), it's meaningless to run the test suite in parallel by specifying `-jN` when invoking the `prove` utility.\n\n[Back to TOC](#table-of-contents)\n\nGetting involved\n================\n\nYou'll be very welcomed to submit patches to the [author](#author) or just ask for a commit bit to the [source repository](#source-repository) on GitHub.\n\n[Back to TOC](#table-of-contents)\n\nAuthor\n======\n\nYichun Zhang (agentzh) *\u0026lt;agentzh@gmail.com\u0026gt;*, OpenResty Inc.\n\nThis wiki page is also maintained by the author himself, and everybody is encouraged to improve this page as well.\n\n[Back to TOC](#table-of-contents)\n\nCopyright \u0026 License\n===================\n\nCopyright (C) 2009-2018, Yichun Zhang (章亦春) \u003cagentzh@gmail.com\u003e, OpenResty Inc.\n\nThis module is licensed under the terms of the BSD license.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n[Back to TOC](#table-of-contents)\n\nSee Also\n========\n* [Nginx Devel Kit](https://github.com/simpl/ngx_devel_kit)\n* [The OpenResty bundle](http://openresty.org)\n\n[Back to TOC](#table-of-contents)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenresty%2Fset-misc-nginx-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenresty%2Fset-misc-nginx-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenresty%2Fset-misc-nginx-module/lists"}