summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-05-26 14:38:42 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-31 12:40:02 +0200
commit9bf614cd0874e0ef9fda3145faacd3ef3a5fb0ed (patch)
treea0c96d103fede547a0e5baf8e88a7c2e3053d3e9 /docs
parent8027e7ce0f3c7558647661864fd742d9afb33374 (diff)
downloadunit-9bf614cd0874e0ef9fda3145faacd3ef3a5fb0ed.tar.gz
unit-9bf614cd0874e0ef9fda3145faacd3ef3a5fb0ed.tar.bz2
Var: Added $request_uri (as in NGINX).
This supports a new variable $request_uri that contains the path and the query (See RFC 3986, section 3). Its contents are percent encoded. This is useful for example to redirect HTTP to HTTPS: { "return": "301", "location": "https://$host$request_uri" } When <http://example.com/foo%23bar?baz> is requested, the server redirects to <https://example.com/foo%23bar?baz>. === Testing: //diff --git a/src/nxt_http_return.c b/src/nxt_http_return.c //index 82c9156..adeb3a1 100644 //--- a/src/nxt_http_return.c //+++ b/src/nxt_http_return.c //@@ -196,6 +196,7 @@ nxt_http_return_send_ready(nxt_task_t *task, void *obj, void *data) // field->value = ctx->encoded.start; // field->value_length = ctx->encoded.length; // } //+ fprintf(stderr, "ALX: target[%1$i]: <%2$.*1$s>\n", (int)r->target.length, r->target.start); // // r->state = &nxt_http_return_send_state; // { "listeners": { "*:81": { "pass": "routes/ru" } }, "routes": { "ru": [{ "action": { "return": 301, "location": "$request_uri" } }] } } $ curl -i http://localhost:81/*foo%2Abar?baz#arg HTTP/1.1 301 Moved Permanently Location: /*foo%2Abar?baz Server: Unit/1.27.0 Date: Mon, 30 May 2022 16:04:30 GMT Content-Length: 0 $ sudo cat /usr/local/unit.log | grep ALX ALX: target[15]: </*foo%2Abar?baz>
Diffstat (limited to 'docs')
-rw-r--r--docs/changes.xml6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/changes.xml b/docs/changes.xml
index db352022..c1cf96d2 100644
--- a/docs/changes.xml
+++ b/docs/changes.xml
@@ -57,6 +57,12 @@ variables support in the "location" option of the "return" action.
<change type="feature">
<para>
+added new variable $request_uri with the same meaning as in NGINX.
+</para>
+</change>
+
+<change type="feature">
+<para>
compatibility with GCC 12.
</para>
</change>