Solved

Apache 2.0 Mod_Rewrite without Redirect

Posted on 2003-12-11
6
1,191 Views
Last Modified: 2007-12-19
Hello Experts,
   We have the following setup in one of our production system.

External world -->  HardWare LoadBalancer --> Apache 2.0 --> Weblogic 7.0

Apache 2.0 and Weblogic talk to each other using the standard plugin provided by BEA. We are using one more protocol called Webdav (Which is nothing but a wrapper around http protocol). This protocol is not understandable by apache-weblogic plugin. So we are running into problems.

The only way to circumvent this problem is to bypass apache and directly contact weblogic. Please note that we can't change the URL of the external world at any cost. So we thought of using mod_rewrite in apache. The basic idea is simple as follows.

for ex : http://myserver.com/PF.jsp will get translated to http://myserver.com:7001/PF.jsp.

The problem with this approach is that, it will do a redirect. And this will be a problem if we use loadbalancer. All the machines are within  (demilitarized zone and all start with 10.x ip which is not exposed to external world). Even the apache machine will receive 10.x.x.x.

So the question is ...Is it possible to have mod_rewrite without external redirect??? Can apache rewrite the url, get the response from weblogic and send it back to the client??

Please let me know in case I need to explain this better. Any thoughts on this will be of great help.

regards
Rajesh.B




0
Comment
Question by:rajesh_bala
  • 3
  • 3
6 Comments
 
LVL 27

Expert Comment

by:BigRat
ID: 9927458
I depends on the rewrite rule which you use. The [R] flag will do a redirect, the [P] flag will do an internal proxy forward. Can you post your rewrite rules here?
0
 
LVL 10

Author Comment

by:rajesh_bala
ID: 9927498
Hi BigRat,
   Thankx for the comments. We have not yet set the rewrite rules as of now. Before writing the rewrite rule, we had a concern that apache will do an external redirect for "rewrite rules" (that is if u manipulate the URL, apache will do an external redirect).

  What I am looking for is something like what you have mentioned as internal proxy forward. Please correct me if I am wrong.

1. Original URL : http://myserver.com/PF.jsp
2. After rewrite by apache : http://myserver.com:7001/PF.jsp
3. If I use [P] flag in rewrite rule, apache will internally get the response from 7001 port and give the reply to the client.

regards
Rajesh.B
0
 
LVL 27

Expert Comment

by:BigRat
ID: 9927693
Correct.

RewriteRule ^(.*)$    http://myserver.com:7001/$1 [P,L]

OK?
0
Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

 
LVL 10

Author Comment

by:rajesh_bala
ID: 9927765
Hello BigRat,
  One more question on this regard. I already mentioned that webdav is a protocol on top of http. Now you have mentioned that apache will do a internal proxy forward to 7001.

But will the headers be preserved by apache??.. Or will it truncate some of the headers and send it to 7001??.

~Rajesh.B
0
 
LVL 27

Accepted Solution

by:
BigRat earned 250 total points
ID: 9937451
>>But will the headers be preserved by apache??..

Basically no.  I have not studied the code, but I know that the basic authentication header will get dropped, since it is only valid for this site. You might find that the extra DAV headers get copied forward. Headers returned usually get sent on unmodified. The exception is Location, to which the proxyPassreverse directive applies.

There are mod_proxy substitutes available - some commerical. Try Google to find them.  You'll probably have to try it to find out.
0
 
LVL 10

Author Comment

by:rajesh_bala
ID: 9954926
Thankx BigRat
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question