Full URL parameter in nginx

nanaya me at myconan.net
Thu Jun 23 11:21:56 UTC 2016


Hi,

On 2016/06/23 20:10, iivan wrote:
> Hi,
> I have this nginx rule:
>
> rewrite ^/(.*)?$ /index.cfm?event=saveURL=$1 last;
>
> - Which makes this work:
> http://mywebsite.com/http://notherwebsite.com/page.html
>
> - But if I pass a parameter like this:
> http://mywebsite.com/http://notherwebsite.com/page.html?id=1
>
> 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.



More information about the nginx mailing list