Solved

Apache 2.0 Mod_Rewrite without Redirect

Posted on 2003-12-11
6
1,178 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now