Solved

Apache 2.0 Mod_Rewrite without Redirect

Posted on 2003-12-11
6
1,186 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
follow the php mysql tuto and tells me what's wrong! 10 31
Apache Issues 9 80
mod_rewrite # anchor problem. 6 17
Cpanel file manager 8 23
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 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