Full URL parameter in nginx

Hi,
I have this nginx rule:

rewrite ^/(.*)?$ /index.cfm?event=saveURL=$1 last;

cuts off ?id=1

How can I fix this? Thank you!

Posted at Nginx Forum:

Hi,

On 2016/06/23 20:10, iivan wrote:

cuts off ?id=1

How can I fix this? Thank you!

rewrite doesn’t match query string due to its non-positional value (is
it the correct term? Also it’s just my guess).

this should work:

rewrite ^/(.*)?$ /index.cfm?event=saveURL=$1$is_args$args last;

or just:

rewrite ^ /index.cfm?event=saveURL=$uri$is_args$args last;

Or might even be:

location / {
proxy_pass
http://myproxy:port/index.cfm?event=saveURL=$uri$is_args$args;
proxy_set_header …;
…;
}

  • no idea about encoding/escaping.

Thanks nanaya,
It is the solution I was looking for!

rewrite ^/(.*)?$ /index.cfm?event=saveURL=$1$is_args$args last;

You are the best :slight_smile:

Posted at Nginx Forum:

Hi nanaya,
today I run a few tests.

this URL:
http://www.website.com/index.php?lvl=cmspage&pageid=14&id_article=52

Return only: http://www.website.com/index.php?lvl=cmspage

you would know how to fix?

Posted at Nginx Forum: