Full URL parameter in nginx

Francis Daly francis at daoine.org
Tue Jul 26 18:55:07 UTC 2016


On Tue, Jul 26, 2016 at 03:46:19AM -0400, iivan wrote:

Hi there,

> ## nginx rule: 
> rewrite ^/(.*)?$ /index.cfm?event=saveURL=$1$is_args$args last; 
> 
> ## this URL: 
> http://www.mywebsite.com/http://www.anotherwebsite.com/index.php?lvl=cmspage&pageid=14&id_article=52
> 
> 
> ## Return only: 
> http://www.anotherwebsite.com/index.php?lvl=cmspage

That config will get nginx to do an internal rewrite to the location
/index.cfm.

What does your /index.cfm do?

That is: nginx does not return
http://www.anotherwebsite.com/index.php?lvl=cmspage, index.cfm does.

You *could* try to do the proper encoding/escaping in the rewrite,
but I am not aware of a simple nginx function that will help you.


I *suspect* that if you replace

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

with

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

(extra ? at the end), or, equivalently, with

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

(no ? at the end, and remove $is_args$args), then you will be able to
tell your /index.cfm to use all of the QUERY_STRING after "event=saveURL="
as the bulk of the thing that should be returned, and it might all do
what you want.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list