Welcome! Log In Create A New Profile


Re: Rewriting query string

Sergey A. Osokin
December 29, 2019 07:00AM
Hi Olaf,

hope you're doing well.

On Sun, Dec 29, 2019 at 04:41:58AM -0500, Olaf van der Spek wrote:
> > rewrite ^(.*)$ $1?ra=$remote_addr break;
> The ra argument is inserted before the original query string. Is it possible
> to append it to the original query string?
> Is this behavior documented somewhere? Couldn't find it.
> Can one also remove certain arguments from the query string this way?

The following code snippet shows another arguments has been added after
the original query:

server {
listen 8080;
location / { return 200 "OK:$request_uri\n"; }

server {
listen 80;
location / {
rewrite ^(.*)$ $1?ra=$remote_addr break;
% curl -i
HTTP/1.1 200 OK
Server: nginx/1.17.7
Date: Sun, 29 Dec 2019 11:51:32 GMT
Content-Type: application/octet-stream
Content-Length: 21
Connection: keep-alive


There are several ways to manage a list of arguments of a query
string and the embedded perl module definitely can help in that

Another approach is to use the following third-party module,

Sergey Osokin
nginx mailing list
Subject Author Posted

Rewriting query string

Olaf van der Spek December 29, 2019 04:41AM

Re: Rewriting query string

Sergey A. Osokin December 29, 2019 07:00AM

Re: Rewriting query string

Francis Daly December 30, 2019 07:04AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 100
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready