rewrite proxy flag set problem

Jonathan Matthews contact at jpluscplusm.com
Mon Mar 26 11:56:47 UTC 2012


On 26 March 2012 12:39, niraj <nginx-forum at nginx.us> wrote:
> Hi
>
>
>  I have installed the catalyst and I am trying to integrate the same
> with Nginx.

I don't know what "the catalyst" is, sorry. I'm not sure I need to, however.

>  rewrite /auction(.*)$ http://192.168.1.210$1;
>
> the following rewrite rule is working for me right now.
>
> If I write rule that u mentioned then it will gives the error
>
> location /auction/ {
> proxy_pass http://192.168.1.210;
> }

You need to tell us what "the error" is. Just saying that an error
occurs really isn't helpful.

> The reason for error might is that because my request is just like..
>
> http://192.168.1.45/auction?id=1332416535292370.0097187543142212
>
> for that I required to write a regular expression
>
>  rewrite /auction(.*)$ http://192.168.1.210$1;

Yes, you need to amend the location clause Maxim and I gave you so
that it doesn't mandate a trailing slash. NB this is a *different*
trailing slash from the one I mentioned previously in this thread.

You need *not* to use any rewrite statements in the way that you're
currently doing. As
http://wiki.nginx.org/NginxHttpRewriteModule#rewrite says: "If the
replacement string begins with http:// then the client will be
redirected".
This means that the only reason the rewrite is working for *you* is
because your client machine has direct access to 192.168.1.210. If you
try to make this work for external users, it won't.

Use the "location" method instead of using "rewrite". Get rid of the
trailing slash.

Jonathan
-- 
Jonathan Matthews
London, Oxford, UK
http://www.jpluscplusm.com/contact.html



More information about the nginx mailing list