Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

(OT) Apache Server issue

by PsychoSpunk (Hermit)
on Dec 05, 2000 at 22:56 UTC ( #45052=perlquestion: print w/ replies, xml ) Need Help??
PsychoSpunk has asked for the wisdom of the Perl Monks concerning the following question:

Warning! This post is off topic and may offend you if you are under the belief that all posts must cover Perl. I am not responsible for any distress caused by reading beyond the disclaimer of this post.

I am primarily a programmer. I am lucky that I get paid to write perl. I am not so lucky that I have to do some oddball system adminstration work every once in a while. This is about the oddball system administration work with Apache that I am trying to do right now with mod_rewrite.

I currently have a client that has two web servers, A and B. A is running IIS and will be known as www.example.com. B will be accessed through redirection on A if the server gets a request for www.example.com/webapp and A will return www.webapp.example.com as the new location on the browser.

My task is to avoid the location change. This is a decree from the marketroids on high. :) In an attempt to do this, I initially employed mod_rewrite and made a ruleset that came close to my desired output. There was a sole issue, I did in fact create an infinite loop between the web servers.

I am presuming that since B, running linux/apache, is the final destination, it will be in charge of creating the final location bar text. But I can't figure out how to stop mod_rewrite from preparsing the rules and the subsequent redirection back to A. I know that there are some sysadmins hanging out around these parts, so I figured that perhaps I can make use of your black magic, in the hopes that someday you may have a question that I can answer in return.

I now return you to your regularly expressed perl questions.

ALL HAIL BRAK!!!

Comment on (OT) Apache Server issue
Re: (OT) Apache Server issue
by Anonymous Monk on Dec 06, 2000 at 00:13 UTC

    Warning! This post is off topic and may offend you if you are under the belief that all posts must cover Perl. I am not responsible for any distress caused by reading beyond the disclaimer of this post.

    Forgive me for being stupid, but why do you even expect to get a good answer to your question? People use Perlmonks because they know or are learning perl, not apache and not swiss cheese hill rolling.

      Forgive me for being stupid, but why do you even expect to get a good answer to your question? People use Perlmonks because they know or are learning perl, not apache and not swiss cheese hill rolling.

      Because I am a monk by ranking and I expect that we are here to help each other expand our knowledge. In many regards that is related to perl, but every so often a renegade question that only slightly involves perl (such as web servers, databases, and other things Perl glues together) comes through, and as long as the poster is humble about the OTness, someone will provide a friendly answer knowing that the poster will then be able to return to coding some Perl. :)

      Of course, if you read my post and some of the other users home nodes, you'd see that I have a reasonable chance of getting a good answer. A lot of the other monks are sysadmins, and I am seeking their advice. Thanks for playing.

      ALL HAIL BRAK!!!

      You know, AM, it's pretty tough to take you seriously when you troll.

      However, it appears that this site is somewhat tolerant of OT posts, provided they're clearly marked as such.

      Pardon me if this sounds a bit out of line, but get a grip and please consider reviewing earlier posts along these lines. For me, (kudra: some ot is appropriate) RE: Non-Perl Topic OK? speak volumes. 'Kay?

      --f
Re: (OT) Apache Server issue
by iamnothing (Friar) on Dec 06, 2000 at 01:11 UTC
    Alright, are you redirecting the entire request to B (apache) or does IIS split the request depending on ASP (for say, banner requests, etc) and accept the return? I'm taking a look through mod_rewrite right now, but I'm not sure about the full extent of what you're returning and to where.

    What I seem to get is that this occurs:
    IIS >> Apache (mod_rewrite) >> IIS

    And you want:
    IIS >> Apache (mod_rewrite) >> browser

    But then I reread it and get confused as to whether apache is only processing a piece of the code, which it would then have to return to IIS for inclusion into what needs to be returned to the browser.

    Any clarification would help out, since I think I got lost a little bit in the example posted.

      What I seem to get is that this occurs:
      IIS >> Apache (mod_rewrite) >> IIS

      And you want:
      IIS >> Apache (mod_rewrite) >> browser

      iamnothing, you are correct in the above statement. If the user is redirected to B, I want B to do all of the processing and returning of the results. A should be completely out of the picture once it has performed a redirect to B. B should, however, not be known to the user and report that it is indeed A.

      It should be noted that at this point, A is already doing what it is supposed to do. If it receives a request for the page www.example.com/webapp, it redirects to B. Unless I can redirect to B from A and make sure that A doesn't change the user's browser to report that it was redirected to B, I don't need to do anything to A at this point. But I don't think that IIS has that ability, although I may be incorrect.

      ALL HAIL BRAK!!!

        I'm thinking the same thing, that the problem is not so much in Perl but with the way that IIS performs redirection (unless you are using Perl to perform the redirection).

        Have you thought of setting up Apache with a Virtual server name that is the same as A (which shouldn't conflict as long as it doesn't have to pass information back to the real server) should a redirection occur?

        I'm installing IIS now. I'll fire up apache on linux and see if I can get it to pretend to be another machine. Won't be able to get to it all today because I have to do some Java training for staff members in about twenty minutes, but I should have some sort of answer (even if it's "hell, I don't know!") by tomorrow some time.

Re: (OT) Apache Server issue
by marius (Hermit) on Dec 06, 2000 at 04:57 UTC
    Another hacked method to do it -- employ frames. Make the www.example.com/webapp URL a frameset with a one pixel top frame (or side, bottom, what have you) and a * for the other frame. the other frame's source is the linux box. It's a rig, admittedly, and isn't the fully correct way to do it, but it'll work. That's how quite a few websites keep you clicking links but only their www.domain.TLD stays in your location bar.

    -marius
Re: (OT) Apache Server issue
by iamnothing (Friar) on Dec 08, 2000 at 00:38 UTC
    Sorry it took me so long to get back. A bit of training for the staff seemed necessary to my boss. After a lot of tinkering in apache, I got it to work. Part of my problem with the tinkering was only setting up rudimentary virtual hosts in the past with apache. Once I dug my mind into the docs I have, everything was fine.

    If you don't want to use the frame reference (which I'd recommend because it's actually much simpler, and who knows just what problems this could cause since I'm working in an office between two machines and not in a production environment), you can try it this way. I just wouldn't recommend it in a production environment.

    Okay, first of all, handle all redirection with IP adresses. This will usually counter any problems with hitting the DNS server first and having it get confused between the real server (A) and the one masquerading as the real server (B).

    If both servers were running apache, this wouldn't be an issue since you could just use Alias rather than Redirect, but unfortunately, that's not the case.

    Once you have the virtual host setup in Apache's httpd.conf, and restart the server, test the simple redirection on IIS to the ip. It should do it correctly and still have the correct information in the location bar. If the user clicks reload, though, it will return them to the original server and then process the redirection again.

    If you want to maintain the /webapps directory structure in the web code, make sure that you create the webapps directory under the home. Then you can redirect any access to the home directory back to the IIS server (using IP addresses to avoid the DNS database confusion).

    Like I said, though. You should really go the frames direction because then you can redirect frames to whatever server migration may come along in the future. Jumping through these hoops may only lead to future dilemmas.

    I must say, though, it was a fun problem for me to play with, though.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://45052]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2014-08-21 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (136 votes), past polls