You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tushar Chavan <tu...@hotmail.com> on 2010/11/01 08:54:39 UTC

[users@httpd] RewriteRule : How to retain Apache Host in the url

Hi Experts,
 
We have definded rewrite rule as below
RewriteEngine on
RewriteRule ^/(sap\(.*)         http://srmhost.kjo.com.sa:8000/$1
So now whenever url  https://apache_host.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm is called, it
will re-direct to  http://srmhost.kjo.com.sa:8000/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm
which is ok. 
 
But can we retain apache_host name in the url so that srmhost is not visible to the outer world.
 
Best Regards,
Tushar. 		 	   		  

RE: [users@httpd] RewriteRule : How to retain Apache Host in the url

Posted by Tushar Chavan <tu...@hotmail.com>.
Thanks a ton Igor.  P flag worked..
 


Date: Tue, 2 Nov 2010 18:07:26 +1100
From: icicimov@gmail.com
To: users@httpd.apache.org
Subject: Re: [users@httpd] RewriteRule : How to retain Apache Host in the url

Have you tried using the P flag in the RewriteRule?

Cheers,
Igor



On Tue, Nov 2, 2010 at 4:26 PM, Tushar Chavan <tu...@hotmail.com> wrote:


Hi Eric,
 
We have set SERVER_NAME & HTTP_HOST env. variables but still it is not working.
 
Let me explain our scenario.
 
https://srmdevarp01.domain/irj  ( this url will give us the portal page )
 
On the the portal page there is href  ( href="https://srmdevarp01.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm" ) for self registration.
 
Now when anyone will click on the href they will be redirected to the srmsbx host by rewrite rule ( RewriteRule  ^/(sap\(.*)         http://srmsbx.domain:8000/$1  )
 
i.e whoever clicks on the self registration button on the portal page , will be re-directed to http://srmsbx.domain:8000/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm.
 
Now here we want to retain apache host name i.e srmdevarp01 just like we do with   ProxyPreserveHost.
 
Please let me know if there is way to do it.
 
Best Regards,
Tushar

 
> Date: Mon, 1 Nov 2010 08:06:39 -0400
> From: covener@gmail.com
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] RewriteRule : How to retain Apache Host in the url
> 
> On Mon, Nov 1, 2010 at 3:54 AM, Tushar Chavan <tu...@hotmail.com> wrote:
> > Hi Experts,
> >
> > We have definded rewrite rule as below
> > RewriteEngine on
> > RewriteRule ^/(sap\(.*)         http://srmhost.kjo.com.sa:8000/$1
> > So now whenever url
> > https://apache_host.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm
> > is called, it
> > will re-direct to
> > http://srmhost.kjo.com.sa:8000/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm
> > which is ok.
> 
> %{SERVER_NAME} or %{HTTP_HOST}
> >
> > But can we retain apache_host name in the url so that srmhost is not visible
> > to the outer world.
> >
> > Best Regards,
> > Tushar.
> >
> 
> 
> 
> -- 
> Eric Covener
> covener@gmail.com
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

 		 	   		  

Re: [users@httpd] RewriteRule : How to retain Apache Host in the url

Posted by Igor Cicimov <ic...@gmail.com>.
Have you tried using the P flag in the RewriteRule?

Cheers,
Igor


On Tue, Nov 2, 2010 at 4:26 PM, Tushar Chavan <tu...@hotmail.com>wrote:

>  Hi Eric,
>
> We have set SERVER_NAME & HTTP_HOST env. variables but still it is not
> working.
>
> Let me explain our scenario.
>
> https://srmdevarp01.domain/irj  ( this url will give us the portal page )
>
> On the the portal page there is href  ( href="
> https://srmdevarp01.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm<https://srmdevarp01.domain/sap%28bD1lbiZjPTAxNiZkPW1pbg==%29/bc/bsp/sap/z_ros_self_reg1/main.htm>"
> ) for self registration.
>
> Now when anyone will click on the href they will be redirected to the
> srmsbx host by rewrite rule ( RewriteRule  ^/(sap\(.*)
> http://srmsbx.domain:8000/$1  )
>
> i.e whoever clicks on the self registration button on the portal page ,
> will be re-directed to http://srmsbx.domain:8000/*
> sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm*<http://srmsbx.domain:8000/sap%28bD1lbiZjPTAxNiZkPW1pbg==%29/bc/bsp/sap/z_ros_self_reg1/main.htm>
> .
> **
> Now here we want to *retain apache host name i.e srmdevarp01* just like we
> do with   ProxyPreserveHost.
>
> Please let me know if there is way to do it.
>
> Best Regards,
> Tushar
>
>
> > Date: Mon, 1 Nov 2010 08:06:39 -0400
> > From: covener@gmail.com
> > To: users@httpd.apache.org
> > Subject: Re: [users@httpd] RewriteRule : How to retain Apache Host in
> the url
> >
> > On Mon, Nov 1, 2010 at 3:54 AM, Tushar Chavan <tu...@hotmail.com>
> wrote:
> > > Hi Experts,
> > >
> > > We have definded rewrite rule as below
> > > RewriteEngine on
> > > RewriteRule ^/(sap\(.*)         http://srmhost.kjo.com.sa:8000/$1
> > > So now whenever url
> > >
> https://apache_host.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm<https://apache_host.domain/sap%28bD1lbiZjPTAxNiZkPW1pbg==%29/bc/bsp/sap/z_ros_self_reg1/main.htm>
> > > is called, it
> > > will re-direct to
> > >
> http://srmhost.kjo.com.sa:8000/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm<http://srmhost.kjo.com.sa:8000/sap%28bD1lbiZjPTAxNiZkPW1pbg==%29/bc/bsp/sap/z_ros_self_reg1/main.htm>
> > > which is ok.
> >
> > %{SERVER_NAME} or %{HTTP_HOST}
> > >
> > > But can we retain apache_host name in the url so that srmhost is not
> visible
> > > to the outer world.
> > >
> > > Best Regards,
> > > Tushar.
> > >
> >
> >
> >
> > --
> > Eric Covener
> > covener@gmail.com
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
> Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > " from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
>

RE: [users@httpd] RewriteRule : How to retain Apache Host in the url

Posted by Tushar Chavan <tu...@hotmail.com>.
Hi Eric,
 
We have set SERVER_NAME & HTTP_HOST env. variables but still it is not working.
 
Let me explain our scenario.
 
https://srmdevarp01.domain/irj  ( this url will give us the portal page )
 
On the the portal page there is href  ( href="https://srmdevarp01.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm" ) for self registration.
 
Now when anyone will click on the href they will be redirected to the srmsbx host by rewrite rule ( RewriteRule  ^/(sap\(.*)         http://srmsbx.domain:8000/$1  )
 
i.e whoever clicks on the self registration button on the portal page , will be re-directed to http://srmsbx.domain:8000/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm.
 
Now here we want to retain apache host name i.e srmdevarp01 just like we do with   ProxyPreserveHost.
 
Please let me know if there is way to do it.
 
Best Regards,
Tushar

 
> Date: Mon, 1 Nov 2010 08:06:39 -0400
> From: covener@gmail.com
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] RewriteRule : How to retain Apache Host in the url
> 
> On Mon, Nov 1, 2010 at 3:54 AM, Tushar Chavan <tu...@hotmail.com> wrote:
> > Hi Experts,
> >
> > We have definded rewrite rule as below
> > RewriteEngine on
> > RewriteRule ^/(sap\(.*)         http://srmhost.kjo.com.sa:8000/$1
> > So now whenever url
> > https://apache_host.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm
> > is called, it
> > will re-direct to
> > http://srmhost.kjo.com.sa:8000/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm
> > which is ok.
> 
> %{SERVER_NAME} or %{HTTP_HOST}
> >
> > But can we retain apache_host name in the url so that srmhost is not visible
> > to the outer world.
> >
> > Best Regards,
> > Tushar.
> >
> 
> 
> 
> -- 
> Eric Covener
> covener@gmail.com
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
 		 	   		  

Re: [users@httpd] RewriteRule : How to retain Apache Host in the url

Posted by Eric Covener <co...@gmail.com>.
On Mon, Nov 1, 2010 at 3:54 AM, Tushar Chavan <tu...@hotmail.com> wrote:
> Hi Experts,
>
> We have definded rewrite rule as below
> RewriteEngine on
> RewriteRule ^/(sap\(.*)         http://srmhost.kjo.com.sa:8000/$1
> So now whenever url
> https://apache_host.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm
> is called, it
> will re-direct to
> http://srmhost.kjo.com.sa:8000/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm
> which is ok.

%{SERVER_NAME} or %{HTTP_HOST}
>
> But can we retain apache_host name in the url so that srmhost is not visible
> to the outer world.
>
> Best Regards,
> Tushar.
>



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want more info about logging works

Posted by Jeroen Geilman <je...@adaptr.nl>.
On 12/01/2010 07:38 PM, mabra@manfbraun.de wrote:
> Hello !
>
> I am just using this to log:
>
> LogFormat \
> 	"%{%F %T}t\t%v\t%p\t%h\t%{User-Agent} ... \
> 	vhost_combined2
>
> CustomLog "|/usr/bin/mono /test/eco.exe /var/log/apache2/extra_log 86400" \
> 	vhost_combined2
>    

Okay.

> May I use just a named pipe?

You may log to any target the CustomLog documentation says is supported.

>   What will happen, it the reader has a short
> "dropout", is there a buffer and if not, would apache continue to log
> to that pipe later?
>    

If the logging process is interrupted for any reason, apache can 
obviously not guarantee logging.

> If I use only one [global] logging directive, would all instances
> really use this one log?
>    

Yes.

> Because the timestamp does not contain milliseconds, how can I
> determine, which request was the first? Would it help me, just
> to subtract the processing-time?
>    

Probably not.
Use a logging mechanism that records milli- or microseconds if you need 
that.
The apache log contains the time of *completion* for the entire request, 
not the start time.

> It would really help me to understand, how the logging
> is really working!
>    

It's well documented at http://httpd.apache.org/docs/current/logs.html


-- 
J.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Want more info about logging works

Posted by ma...@manfbraun.de.
Hello !

I am just using this to log:

LogFormat \
	"%{%F %T}t\t%v\t%p\t%h\t%{User-Agent} ... \
	vhost_combined2

CustomLog "|/usr/bin/mono /test/eco.exe /var/log/apache2/extra_log 86400" \
	vhost_combined2

May I use just a named pipe? What will happen, it the reader has a short
"dropout", is there a buffer and if not, would apache continue to log
to that pipe later?

If I use only one [global] logging directive, would all instances
really use this one log?

Because the timestamp does not contain milliseconds, how can I
determine, which request was the first? Would it help me, just
to subtract the processing-time?

It would really help me to understand, how the logging
is really working!

Thanks a lot!

br++mabra



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RewriteRule : How to retain Apache Host in the url

Posted by Sai A <ar...@gmail.com>.
Tom,

Thanks for that correction. I got a little confused.

On Fri, Nov 12, 2010 at 4:01 PM, Tom Evans <te...@googlemail.com> wrote:

> On Fri, Nov 12, 2010 at 10:16 AM, Sai A <ar...@gmail.com> wrote:
> > More specifically, look at the
> > ProxyPass and ProxyPassReverse directives that are present in mod_proxy.
> >
> > There is another directive called PreserveProxyHost that
> > you'll have to set to on and the URL won't change in the address bar
> (HTTP
> > header).
> >
> > Sai
>
> That isn't what *ProxyPreserveHost* does. If ProxyPreserveHost is set
> to true, then the proxied request will retain the same Host header as
> the original request to the proxy. If it is not set, mod_proxy_http
> will replace the originally requested host header with the host
> specified in the ProxyPass line.
>
> See http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost
> for more details.
>
> Cheers
>
> Tom
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] RewriteRule : How to retain Apache Host in the url

Posted by Tom Evans <te...@googlemail.com>.
On Fri, Nov 12, 2010 at 10:16 AM, Sai A <ar...@gmail.com> wrote:
> More specifically, look at the
> ProxyPass and ProxyPassReverse directives that are present in mod_proxy.
>
> There is another directive called PreserveProxyHost that
> you'll have to set to on and the URL won't change in the address bar (HTTP
> header).
>
> Sai

That isn't what *ProxyPreserveHost* does. If ProxyPreserveHost is set
to true, then the proxied request will retain the same Host header as
the original request to the proxy. If it is not set, mod_proxy_http
will replace the originally requested host header with the host
specified in the ProxyPass line.

See http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost
for more details.

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RewriteRule : How to retain Apache Host in the url

Posted by Sai A <ar...@gmail.com>.
More specifically, look at the
ProxyPass and ProxyPassReverse directives that are present in mod_proxy.

There is another directive called PreserveProxyHost that
you'll have to set to on and the URL won't change in the address bar (HTTP
header).

Sai
On Fri, Nov 12, 2010 at 3:20 PM, Green Wang <co...@gmail.com> wrote:

>  you can use mod_proxy
>
> On 11/01/2010 03:54 PM, Tushar Chavan wrote:
>
> Hi Experts,
>
> We have definded rewrite rule as below
> RewriteEngine on
> RewriteRule ^/(sap\(.*)         http://srmhost.kjo.com.sa:8000/$1
> So now whenever url
> https://apache_host.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm<https://apache_host.domain/sap%28bD1lbiZjPTAxNiZkPW1pbg==%29/bc/bsp/sap/z_ros_self_reg1/main.htm>is called, it
> will re-direct to
> http://srmhost.kjo.com.sa:8000/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm<http://srmhost.kjo.com.sa:8000/sap%28bD1lbiZjPTAxNiZkPW1pbg==%29/bc/bsp/sap/z_ros_self_reg1/main.htm>
> which is ok.
>
> But can we retain apache_host name in the url so that srmhost is not
> visible to the outer world.
>
> Best Regards,
> Tushar.
>
>

Re: [users@httpd] RewriteRule : How to retain Apache Host in the url

Posted by Green Wang <co...@gmail.com>.
you can use mod_proxy

On 11/01/2010 03:54 PM, Tushar Chavan wrote:
> Hi Experts,
>
> We have definded rewrite rule as below
> RewriteEngine on
> RewriteRule ^/(sap\(.*) http://srmhost.kjo.com.sa:8000/$1
> So now whenever url 
> https://apache_host.domain/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm 
> <https://apache_host.domain/sap%28bD1lbiZjPTAxNiZkPW1pbg==%29/bc/bsp/sap/z_ros_self_reg1/main.htm> 
> is called, it
> will re-direct to 
> http://srmhost.kjo.com.sa:8000/sap(bD1lbiZjPTAxNiZkPW1pbg==)/bc/bsp/sap/z_ros_self_reg1/main.htm 
> <http://srmhost.kjo.com.sa:8000/sap%28bD1lbiZjPTAxNiZkPW1pbg==%29/bc/bsp/sap/z_ros_self_reg1/main.htm>
> which is ok.
>
> But can we retain apache_host name in the url so that srmhost is not 
> visible to the outer world.
>
> Best Regards,
> Tushar.