You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Charles Li <cl...@yahoo.com> on 2008/02/12 20:48:29 UTC

[users@httpd] redirect and hide the port number

I am trying to use rewrite to direct selected traffic
from the HTTP server (oracle iAS) to a oc4j container
on the same server.
I would like to hide the port number.  Is it possible?

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^.*storePRE.*$ [NC]
    RewriteRule ^/$ http://server:8888/basic.jsp [R]

When users access http://storePre.com, they would be
directed to http://server:8888/basic.jsp.
I would like it to be http://server/basic.jsp.  Is it
possible?

Thanks,
Charles Li




      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

---------------------------------------------------------------------
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] redirect and hide the port number

Posted by Krist van Besien <kr...@gmail.com>.
On Wed, Feb 13, 2008 at 9:48 PM, Charles Li <cl...@yahoo.com> wrote:

>  Seems to me these does the same thing, or am I wrong?
>
>  RewriteRule ^/basic$ http://server:8888/basic.jsp [P]
>
>  vs
>
>  ProxyPass /basic http://server:8888/basic.jsp
>
>  If yes, does it matter which one I use?

They do the same thing. The second option does not require
mod_rewrite. The first option allows more complex forward proxy
setups. It's up to you really what you use.

Krist


-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
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] redirect and hide the port number

Posted by Charles Li <cl...@yahoo.com>.
--- Krist van Besien <kr...@gmail.com>
wrote:

> On Feb 13, 2008 3:44 PM, Charles Li
> <cl...@yahoo.com> wrote:
> 
> > So, all I have to change is the R to a P?
> > Is this correct:
> >
> >      RewriteEngine on
> >      RewriteCond %{HTTP_HOST} ^.*storePRE.*$ [NC]
> >      RewriteRule ^/$ http://server:8888/basic.jsp
> [P]
> 
> Yes.
> 
> Krist
> 
> 
> 
> -- 
> krist.vanbesien@gmail.com
> krist@vanbesien.org
> Bremgarten b. Bern, Switzerland
> --
> A: It reverses the normal flow of conversation.
> Q: What's wrong with top-posting?
> A: Top-posting.
> Q: What's the biggest scourge on plain text email
> discussions?
> 
>
---------------------------------------------------------------------
> 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
> 
> 


Seems to me these does the same thing, or am I wrong?

RewriteRule ^/basic$ http://server:8888/basic.jsp [P]

vs 

ProxyPass /basic http://server:8888/basic.jsp

If yes, does it matter which one I use?

Thanks.


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

---------------------------------------------------------------------
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] redirect and hide the port number

Posted by Krist van Besien <kr...@gmail.com>.
On Feb 13, 2008 3:44 PM, Charles Li <cl...@yahoo.com> wrote:

> So, all I have to change is the R to a P?
> Is this correct:
>
>      RewriteEngine on
>      RewriteCond %{HTTP_HOST} ^.*storePRE.*$ [NC]
>      RewriteRule ^/$ http://server:8888/basic.jsp [P]

Yes.

Krist



-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
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] redirect and hide the port number

Posted by Charles Li <cl...@yahoo.com>.
--- Krist van Besien <kr...@gmail.com>
wrote:

> On Feb 12, 2008 8:48 PM, Charles Li
> <cl...@yahoo.com> wrote:
> > I am trying to use rewrite to direct selected
> traffic
> > from the HTTP server (oracle iAS) to a oc4j
> container
> > on the same server.
> > I would like to hide the port number.  Is it
> possible?
> >
> >     RewriteEngine on
> >     RewriteCond %{HTTP_HOST} ^.*storePRE.*$ [NC]
> >     RewriteRule ^/$ http://server:8888/basic.jsp
> [R]
> >
> > When users access http://storePre.com, they would
> be
> > directed to http://server:8888/basic.jsp.
> > I would like it to be http://server/basic.jsp.  Is
> it
> > possible?
> 
> It is possible. You need to proxy in stead of
> redirect. Use [P] in
> stead of [R], and have mod_proxy enabled.
> 
> Krist
> 
> -- 
> krist.vanbesien@gmail.com
> krist@vanbesien.org
> Bremgarten b. Bern, Switzerland
> --
> A: It reverses the normal flow of conversation.
> Q: What's wrong with top-posting?
> A: Top-posting.
> Q: What's the biggest scourge on plain text email
> discussions?
> 
>
---------------------------------------------------------------------
> 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
> 
> 

So, all I have to change is the R to a P?
Is this correct: 

     RewriteEngine on
     RewriteCond %{HTTP_HOST} ^.*storePRE.*$ [NC]
     RewriteRule ^/$ http://server:8888/basic.jsp [P]

Would the user see http://server/basic.jsp, when
redirected, without the port number?

Thanks.


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

---------------------------------------------------------------------
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] redirect and hide the port number

Posted by Krist van Besien <kr...@gmail.com>.
On Feb 12, 2008 8:48 PM, Charles Li <cl...@yahoo.com> wrote:
> I am trying to use rewrite to direct selected traffic
> from the HTTP server (oracle iAS) to a oc4j container
> on the same server.
> I would like to hide the port number.  Is it possible?
>
>     RewriteEngine on
>     RewriteCond %{HTTP_HOST} ^.*storePRE.*$ [NC]
>     RewriteRule ^/$ http://server:8888/basic.jsp [R]
>
> When users access http://storePre.com, they would be
> directed to http://server:8888/basic.jsp.
> I would like it to be http://server/basic.jsp.  Is it
> possible?

It is possible. You need to proxy in stead of redirect. Use [P] in
stead of [R], and have mod_proxy enabled.

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
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] help with redirect base on context

Posted by Joshua Slive <jo...@slive.ca>.
On Feb 12, 2008 3:32 PM, Charles Li <cl...@yahoo.com> wrote:
> I would like to redirect base on the context:
>
> When user access my server with the following:
>
> http://server/outside
>
> I would like to redirect them to another site.
> I try the following, but did not get it work.
>
>     RewriteEngine on
>     RewriteCond %{REQUEST_URI} ^/outside$   [NC]
>     RewriteRule ^/$ http://server/basic.jsp [R]
>
> It just gives me a page not found 404.
> Please can yo point out what am I doing wrong?

The regex in the RewriteRule matches ONLY /, thereby contradicting the
RewriteCond. It sounds like you just want
RewriteRule ^/outside$ http://server/basic.jsp [R]

Use the RewriteLog to see what mod_rewrite is doing.

Joshua.

---------------------------------------------------------------------
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] help with redirect base on context

Posted by Charles Li <cl...@yahoo.com>.
I would like to redirect base on the context:

When user access my server with the following:

http://server/outside

I would like to redirect them to another site.
I try the following, but did not get it work.

    RewriteEngine on
    RewriteCond %{REQUEST_URI} ^/outside$   [NC]
    RewriteRule ^/$ http://server/basic.jsp [R]

It just gives me a page not found 404.
Please can yo point out what am I doing wrong?

Thanks.



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


---------------------------------------------------------------------
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