# Rewrite proxy flag set problem

**URL:** <https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184>\
**Category:** NGINX\
**Created:** [March 23, 2012, 12:17pm UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184 "2012-03-23T12:17:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [March 23, 2012, 12:17pm UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/1 "2012-03-23T12:17:22Z")

</div>

Hi

```
  I have write a one rewrite rule as below

```

rewrite /auction(.\*)$ [http://192.168.1.210$1](http://192.168.1.210$1);

This rewrite rule working fine for me.

but the problem is it show the Ip address 192.168.1.210 also.

I want to hide this IP , for that in apache flage [P] is there.

but Nginx I dont know how to set proxy flag [P]. Please guide for the  
same.

Posted at Nginx Forum:

> **[rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224274#msg-224274)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 23, 2012, 12:51pm UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/2 "2012-03-23T12:51:31Z")

</div>

Hello!

On Fri, Mar 23, 2012 at 07:16:37AM -0400, niraj wrote:

> I want to hide this IP , for that in apache flage [P] is there.
> 
> but Nginx I dont know how to set proxy flag [P]. Please guide for the  
> same.

Use

location /auction/ {  
proxy\_pass [http://192.168.1.210/](http://192.168.1.210/);  
}

instead.

Maxim D.

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 24, 2012, 12:49pm UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/3 "2012-03-24T12:49:01Z")

</div>

Hi

```
 I know that solution but it will not work in my case, I am using

```

the reguralar expression.

Proxy pass not support regural expression right ?

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224324#msg-224324)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 26, 2012, 1:04pm UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/4 "2012-03-26T13:04:38Z")

</div>

You state that “it will not work in my case [as] I am using the  
regular expression”, but don’t provide any examples of how you’re  
doing this or how it breaks.

Please provide a fuller and more complete set of examples.

You could also try removing the trailing slash from Maxim’s rewritten  
example. i.e.

location /auction/ {  
proxy\_pass [http://192.168.1.210](http://192.168.1.210);  
}

This will pass on the remainder of the URI’s path more equivalently to  
your original example.

## Jonathan

Jonathan M.  
London, Oxford, UK

> **[Jonathan Matthews :: Words Typed, Great Rates For Cash](https://www.jpluscplusm.com)**

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 26, 2012, 11:42am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/5 "2012-03-26T11:42:37Z")

</div>

Is there any other way to complete my requirement ??

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224393#msg-224393)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 26, 2012, 1:40pm UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/6 "2012-03-26T13:40:44Z")

</div>

Hi

I have installed the catalyst and I am trying to integrate the same  
with Nginx.

rewrite /auction(.\*)$ [http://192.168.1.210$1](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](http://192.168.1.210);  
}

The reason for error might is that because my request is just like…

[http://192.168.1.45/auction?id=1332416535292370.0097187543142212](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](http://192.168.1.210$1);

Hope Now you understand my point clearly.

If required any other info then let me know.

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224402#msg-224402)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 26, 2012, 2:27pm UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/7 "2012-03-26T14:27:59Z")

</div>

Hi

```
 Let me clear my question again.

 My current problem is if I used the rewrite rules my site is

```

working(this is my testing machine so Ip just like 192.168…), but  
problem is it not show the original server Ip , instead it show the  
192.168.1.210 at client side, I want to hide this Ip 192.168.1.210.  
want to show the original server IP when redirect happened.  
Hope you clear with my requirement.

Now I have set this in nginx, I just give u my nginx configuration  
details as below

server {  
listen 80;  
server\_name localhost;

```
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;

location / {
    root /var/www/vendx/html_asp;
    index index.html index.shtml;
}

location \.(js|css|png|jpg|jpeg|gif|ico|html|xml)$ {}

```

location /auction/ {  
proxy\_pass [http://192.168.1.210](http://192.168.1.210);  
}

```
location ~ \.(cgi|pm)$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /var/www/vendx$fastcgi_script_name;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

```

}

I am getting the following error when redirect happened  
…

2012/03/26 17:32:24 [error] 5349#0: \*1 open()  
“/var/www/vendx/html\_asp/stylesheet” failed (2: No such file or  
directory), client: 192.168.1.44, server: localhost, request: “GET  
/stylesheet HTTP/1.1”, host: “192.168.1.45”, referrer:  
“[http://192.168.1.45/auction/?id=1332416535292370.0097187543142212](http://192.168.1.45/auction/?id=1332416535292370.0097187543142212)”  
2012/03/26 17:32:24 [error] 5349#0: \*5 open()  
“/var/www/vendx/html\_asp/static/images/error.png” failed (2: No such  
file or directory), client: 192.168.1.44, server: localhost, request:  
“GET /static/images/error.png HTTP/1.1”, host: “192.168.1.45”, referrer:  
“[http://192.168.1.45/auction/?id=1332416535292370.0097187543142212](http://192.168.1.45/auction/?id=1332416535292370.0097187543142212)”  
2012/03/26 17:32:24 [error] 5349#0: \*1 directory index of  
“/var/www/vendx/html\_asp/scripts/” is forbidden, client: 192.168.1.44,  
server: localhost, request: “GET /scripts/ HTTP/1.1”, host:  
“192.168.1.45”, referrer:  
“[http://192.168.1.45/auction/?id=1332416535292370.0097187543142212](http://192.168.1.45/auction/?id=1332416535292370.0097187543142212)”  
2012/03/26 17:32:24 [error] 5349#0: \*1 open()  
“/var/www/vendx/html\_asp/static/images/error.png” failed (2: No such  
file or directory), client: 192.168.1.44, server: localhost, request:  
“GET /static/images/error.png HTTP/1.1”, host: “192.168.1.45”, referrer:  
“[http://192.168.1.45/auction/?id=1332416535292370.0097187543142212](http://192.168.1.45/auction/?id=1332416535292370.0097187543142212)”

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224414#msg-224414)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 26, 2012, 3:39pm UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/8 "2012-03-26T15:39:22Z")

</div>

On 26 March 2012 13:27, niraj [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi
> 
> ```
> Let me clear my question again.
> 
> My current problem is if I used the rewrite rules my site is
> 
> ```
> 
> working(this is my testing machine so Ip just like 192.168…), but  
> problem is it not show the original server Ip , instead it show the  
> 192.168.1.210 at client side, I want to hide this Ip 192.168.1.210.

Yes - as I explained, that’s because you were using a redirect with an  
http:// prefix. That’s what it _does_.

> want to show the original server IP when redirect happened.  
> Hope you clear with my requirement.

“Requirements” are what you give to people you’re _paying_ to help you.  
I think you mean “this is what I’m try to achieve” … 😉

> }  
> I think I’ve already suggested the small change that you need to try  
> here. Read my previous email again.

> I am getting the following error when redirect happened

Are these errors in the nginx logs? Ort the logs on 192.168.1.210? In  
response to what single initial request _exactly_?  
Have a read of [http://www.catb.org/~esr/faqs/smart-questions.html#volume](http://www.catb.org/~esr/faqs/smart-questions.html#volume)  
and the rest of that document - it may help.

Cheers,  
Jonathan

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 26, 2012, 1:57pm UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/9 "2012-03-26T13:57:32Z")

</div>

On 26 March 2012 12:39, niraj [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](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](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](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](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  
[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](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 M.  
London, Oxford, UK

> **[Jonathan Matthews :: Words Typed, Great Rates For Cash](https://www.jpluscplusm.com)**

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 6:29am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/10 "2012-03-27T06:29:23Z")

</div>

Hi

```
Sorry for that Mess up.

```

As u suggested I have added the following line

location /auction/ {  
proxy\_pass [http://192.168.1.210](http://192.168.1.210);

when I click into my application I got the error that I mentioned in  
earlier e-mail.

that error log of original server (192.168.1.45) and there is no log  
for 192.168.1.210 error log file.

this is the request that my application is sending to the Nginx

auction?id=1332416535292370.0097187543142212

In above example and as u suggested it will proxy or redirect the  
/auction folder query to the [http://192.168.1.210](http://192.168.1.210);

but you can see above request its not call the /auction folder.

so we required to do something like auction(.\*) am I correct ?

And As I know proxy\_pass not support the regular expression (.\*) is  
it correct ?

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224446#msg-224446)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 7:23am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/11 "2012-03-27T07:23:08Z")

</div>

HI

I was trying the with the following changes

location /auction(.\*)$1 {  
proxy\_pass [http://192.168.1.210$1/](http://192.168.1.210$1/);  
}

It was giving the following error

2012/03/27 10:32:39 [error] 7871#0: \*1 open()  
“/var/www/vendx/html\_asp/auction” failed (2: No such file or directory),  
client: 192.168.1.44, server: localhost, request: “GET  
/auction?id=1332416535292370.0097187543142212 HTTP/1.1”, host:  
“192.168.1.45”, referrer:  
“[http://192.168.1.45/cgi-bin/baybuy\_vendx/index.cgi?vendx\_action=productlist&ShowPopup=1&pageid=10445&ID=20815613327607825242140023430669](http://192.168.1.45/cgi-bin/baybuy_vendx/index.cgi?vendx_action=productlist&ShowPopup=1&pageid=10445&ID=20815613327607825242140023430669)”

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224449#msg-224449)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 7:26am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/12 "2012-03-27T07:26:13Z")

</div>

On Tue, Mar 27, 2012 at 09:18:39AM +0400, Igor S. wrote:

> > when I click into my application I got the error that I mentioned in  
> > In above example and as u suggested it will proxy or redirect the  
> > It seems you need just these two locations:
> 
> location = /auction {  
> proxy\_pass [http://192.168.1.210](http://192.168.1.210);  
> }
> 
> to proxy requests like “/auction?id=1332416535292370.0097187543142212”

Or

location = /auction {  
proxy\_pass [http://192.168.1.210/](http://192.168.1.210/);  
}

if request “/auction?id=1332416535292370.0097187543142212” should be  
proxied to “[http://192.168.1.210/?id=1332416535292370.0097187543142212](http://192.168.1.210/?id=1332416535292370.0097187543142212)”.

–  
Igor S.

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 7:19am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/13 "2012-03-27T07:19:26Z")

</div>

On Tue, Mar 27, 2012 at 12:29:06AM -0400, niraj wrote:

> earlier e-mail.  
> /auction folder query to the [http://192.168.1.210](http://192.168.1.210);
> 
> but you can see above request its not call the /auction folder.
> 
> so we required to do something like auction(.\*) am I correct ?
> 
> And As I know proxy\_pass not support the regular expression (.\*) is  
> it correct ?

You do not need regular expression in this case.  
It seems you need just these two locations:

location = /auction {  
proxy\_pass [http://192.168.1.210](http://192.168.1.210);  
}

to proxy requests like “/auction?id=1332416535292370.0097187543142212”

And

location /auction/ {  
proxy\_pass [http://192.168.1.210/](http://192.168.1.210/);  
}

to proxy “/auction/some/page” to “[http://192.168.1.210/some/page](http://192.168.1.210/some/page)”.

–  
Igor S.

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 7:52am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/14 "2012-03-27T07:52:49Z")

</div>

On Tue, Mar 27, 2012 at 01:47:20AM -0400, niraj wrote:

> }
> 
> Tnx for the solution. And thnx for understanding the requirement.
> 
> I have googling so much but I did not find this = syntax  
> would you suggest for Nginx doc link in that I found such details  
> docs.

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#location)**
>
> This directive appeared in version 1.11.8.

–  
Igor S.

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 8:08am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/15 "2012-03-27T08:08:15Z")

</div>

Hi

```
Thnx for link. We can not do the same with rewrite ?

```

for me with rewrite it was working but the only problem was that the url  
not proxied. its show the 192.168.1.210 at user end instead showing the  
original server name(my case 192.168.1.45).

we can not solve that with rewrite ???

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224458#msg-224458)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 7:47am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/16 "2012-03-27T07:47:52Z")

</div>

Hi

Tnx a lot.

```
          that is what exactly I want to do I have done the

```

following and its works.

location = /auction {  
proxy\_pass [http://192.168.1.210/](http://192.168.1.210/);  
}

Tnx for the solution. And thnx for understanding the requirement.

I have googling so much but I did not find this = syntax  
would you suggest for Nginx doc link in that I found such details  
docs.

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224453#msg-224453)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 8:52am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/17 "2012-03-27T08:52:49Z")

</div>

Hi

```
As I read and from that I understand, Proxypass in apache not used

```

for regular express.

mostly for regular expression in apache used the rewriterule

[mod\_rewrite - Apache HTTP Server Version 2.4](http://httpd.apache.org/docs/current/mod/mod_rewrite.html)

The mod\_rewrite module uses a rule-based rewriting engine, based on a  
PCRE regular-expression parser, to rewrite requested URLs on the fly

Please correct me If I wrong.

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224464#msg-224464)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 10:06am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/18 "2012-03-27T10:06:03Z")

</div>

On Tue, Mar 27, 2012 at 02:52:30AM -0400, niraj wrote:

> PCRE regular-expression parser, to rewrite requested URLs on the fly
> 
> Please correct me If I wrong.

Yes, Apache did not support regexes ProxyPass.  
However, in your case regexes are not needed:

ProxyPass /auction [http://192.168.1.210/](http://192.168.1.210/)

or

\<Location /auction\>  
ProxyPass [http://192.168.1.210/](http://192.168.1.210/)

–  
Igor S.

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 10:51am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/19 "2012-03-27T10:51:20Z")

</div>

Hi

I tried

Proxy\_Pass /auction [http://192.168.1.210/](http://192.168.1.210/);

its not working gives the following error

nginx: [emerg] invalid number of arguments in “proxy\_pass” directive in  
/etc/nginx/conf.d/default.conf:52  
nginx: configuration file /etc/nginx/nginx.conf test failed

Posted at Nginx Forum:

> **[Re: rewrite proxy flag set problem](https://forum.nginx.org/read.php?2,224274,224471#msg-224471)**
>
> Hi I have write a one rewrite rule as below rewrite /auction(.\*)$ http://192.168.1.210$1; This rewrite rule working fine for me. but the problem is it show the Ip address 192.168.1.210 also. I want to hide this IP , fo

---

<div class="post-metadata">

**Author:** ![niraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7ba0ec/32.png) [@niraj](https://www.ruby-forum.com/u/niraj)\
**Post date:** [March 27, 2012, 8:18am UTC](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184/20 "2012-03-27T08:18:09Z")

</div>

On Tue, Mar 27, 2012 at 02:07:34AM -0400, niraj wrote:

> Hi
> 
> ```
> Thnx for link. We can not do the same with rewrite ?
> 
> ```
> 
> for me with rewrite it was working but the only problem was that the url  
> not proxied. its show the 192.168.1.210 at user end instead showing the  
> original server name(my case 192.168.1.45).
> 
> we can not solve that with rewrite ???

No, you cannot proxy with rewrite in nginx.

As to the rewrite usage itself, this is a wrong, cumbersome,  
and ineffective way of configuration in both nginx and Apache.

–  
Igor S.

[Next page](https://www.ruby-forum.com/t/rewrite-proxy-flag-set-problem/218184.md?page=2)
