Author Topic: special URL direction  (Read 3817 times)

Offline jägermonsta

  • Brobdingnagian Member
  • ***
  • Posts: 4441
  • Bigger Than Jesus
    • View Profile
  • Rated:
special URL direction
« on: July 08, 2009, 12:05:15 PM »
i'm not a web guy, I don't do much with web server administrating either. but something has come up here we're looking into doing...

ok... you have 1 dns to a public ip: tool.company.com

now we would like to keep that DNS but have or clients directed to specific servers which will host bi reporting tools specific for the client.

tool.company.com/client1 - directs the client to their reporting server but the url they see STAYS 'tool.company.com/client1'
tool.company.com/client2 - directs the client to their reporting server but the url they see STAYS 'tool.company.com/client2'

See what I'm trying to do? I need the /client* part to direct to a different page but stay with the DNS of 'tool.company.com'. The problem is the reporting server they direct to will obviously be a different physical server then the web server hosting 'tool.company.com' and will have a different local/public ip...

Any idea? No clue how easy or how impossible it is to do or explain... thanks none the less!
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline reaper

  • Opulent Member
  • *
  • Posts: 2872
  • Nice night for a walk, eh? - Nice night for a walk
    • View Profile
  • Rated:
Re: special URL direction
« Reply #1 on: July 08, 2009, 01:24:56 PM »
On the web server you can setup a redirection for any access to "tool.company.com/client1" to go to for instance client1.tool.company.com which is the web server you want that client to go to.  You can do this on the web server, or have a page do the redirection through html.

There is also url rewriting, which is usually done in an apache module or IIS isapi filter.  So something like tool.company.com/* which is an unknown page gets sent to wherever you want.  The rewriting can be very advanced using databases and regular expressions.

So to keep the URL exactly the same and go to a different web server there is really no way.  However you could setup a load-balancer and tool.company.com is a virtual ip on the load-balancer that points to say 10 web servers.  Then based on the source IP of the clients, you can redirect them to a specific web server.  This is not a good idea, and the configuration is not very clean to say the least.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
VaeVictus "reaper is a lying sack of shit and ragequit then had, probably slugs, come alias and beat me, wasnt even the same person playing OBVIOUSLY, accuracies basicly doubled, and strategy

Offline console

  • Brobdingnagian Member
  • ***
  • Posts: 4518
  • "Man, this is the way to travel," said my attorney
    • View Profile
    • tastyspleen.net
  • Rated:
Re: special URL direction
« Reply #2 on: July 08, 2009, 01:50:13 PM »
So to keep the URL exactly the same and go to a different web server there is really no way.

There are a couple ways, if it's reallly necessary...

One could use frames (or an iframe) so that the URL says tool.company.com/client1, but the content for the frame is served from a different URL.

One could configure apache to treat tool.company.com/client1 as a cgi script, and have the cgi script proxy to the back-end server.

Similarly, one could set up a VirtualHost for tool.company.com which used the apache reverse proxy directives to invoke a script which examines the URL and connects to the appropriate back-end system.  E.g.

ProxyRequests off
ProxyPass / http://127.0.0.1:9000/
ProxyPassReverse / http://127.0.0.1:9000
ProxyPreserveHost on

Where localhost:9000 (for example) is the script which looks at the URL and relays to the back-end system...


Just some ideas...

Regards,

quadz

P.S. that said, I agree "client1.tool.company.com" would be nicer...

  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline reaper

  • Opulent Member
  • *
  • Posts: 2872
  • Nice night for a walk, eh? - Nice night for a walk
    • View Profile
  • Rated:
Re: special URL direction
« Reply #3 on: July 08, 2009, 02:04:37 PM »
hmm, yeah guess you could proxy it, looks like there are a few ways to do it.

you could use mod rewrite in apache and send any requests for /client* to a php script that proxies the connection

RewriteCond %{REQUEST_FILENAME} (client*|client)$
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
        RewriteRule (.+) /phpThatUnderstandClientSTuff.php?uri=$1 [QSA]

$1 be a variable assigned from the regex ".+" that matches the url.

So you could add some logic if you had a whole bunch of clients, or different URL's might be input
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
VaeVictus "reaper is a lying sack of shit and ragequit then had, probably slugs, come alias and beat me, wasnt even the same person playing OBVIOUSLY, accuracies basicly doubled, and strategy

Offline jägermonsta

  • Brobdingnagian Member
  • ***
  • Posts: 4441
  • Bigger Than Jesus
    • View Profile
  • Rated:
Re: special URL direction
« Reply #4 on: July 09, 2009, 06:08:41 AM »
Very helpful information guys. I greatly appreciate your feedback on this!

I totally agree though... redirecting to a 'client1.tool.company.com' would be the best approach.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline poopoppa

  • Full Member
  • ***
  • Posts: 135
    • View Profile
  • Rated:
Re: special URL direction
« Reply #5 on: July 10, 2009, 05:23:11 AM »
quadz and reaper... you guys write in code and are probably DBA's?? I've been having aspirations to do the same, just how difficult or even overwhelming is it? It's either that or IT i just know a DBA pays better. Any advise would be appreciated..
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline quadz

  • Loquaciously Multiloquent Member
  • ****
  • Posts: 5352
    • View Profile
  • Rated:
Re: special URL direction
« Reply #6 on: July 10, 2009, 12:43:54 PM »
you guys write in code and are probably DBA's??

I beez a programmer.

I work with databases fairly frequently, but I'm not a database expert.  I get by on books like SQL Cookbook, etc.  I also bought Logic and Databases: The Roots of Relational Theory, as I would like to learn more about the underpinnings of relational theory - but I haven't read that yet.

As a programmer, sometimes a standard SQL-query based relational database isn't ideal for my needs.  Sometimes I'm better served by something lower level but fast like Tokyo Cabinet that gives me direct access to a disk based hash table or b-tree for simple-but-speedy key/value storage.

Regards,

:dohdohdoh:
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
"He knew all the tricks, dramatic irony, metaphor, bathos, puns, parody, litotes and... satire. He was vicious."

Offline poopoppa

  • Full Member
  • ***
  • Posts: 135
    • View Profile
  • Rated:
Re: special URL direction
« Reply #7 on: July 10, 2009, 01:54:56 PM »
ive seen some of the conversation on this forum and from what i've gathered you have a lot of experience with... SQL? Well you can code something in one line when it takes some one else a few paragraphs. You must be good at what you do.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline quadz

  • Loquaciously Multiloquent Member
  • ****
  • Posts: 5352
    • View Profile
  • Rated:
Re: special URL direction
« Reply #8 on: July 10, 2009, 02:14:32 PM »
Well you can code something in one line when it takes some one else a few paragraphs.

As the comp. sci. professor Olin Shivers once said, "I object to doing things that computers can do." :beer:

So for me, that means seeking out programming languages that make my job easier.  Ruby is an example of such a language, in which one can frequently do a lot of work in comparitively few lines of code.  (The same can be said about languages like Python and Perl, which I have also used in the past.)


Regards,

quadz

  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
"He knew all the tricks, dramatic irony, metaphor, bathos, puns, parody, litotes and... satire. He was vicious."

Offline reaper

  • Opulent Member
  • *
  • Posts: 2872
  • Nice night for a walk, eh? - Nice night for a walk
    • View Profile
  • Rated:
Re: special URL direction
« Reply #9 on: July 10, 2009, 02:39:42 PM »
DBA is like a whole expert field in itself.  For instance google will have their own mysql, optimized for their systems.

I guess you could say the original databases were things like two dimensional arrays, and from there things advanced.  There is a lot to databases in any event.

As for writing in code, personally I like to work with *nix and write scripts.  I end up working bash (and the unix utilities) and perl because I end up having to do a lot of text parsing.  Sometimes i'll use hash tables when I have to associate data together, and if it gets more advanced than that, i'll make a connection to an sql command line database. 

I know routers if using the fastest forwarding algorithms will use things like mtrees, and link lists, which I am not exactly sure how they work.  But they help the router associate different things together, like the mac addresses that need to be rewritten in forwarding, and the destination interfaces.  So originally it would be just some bitwise anding to match the destination ip with the appropriate route, and then some parsing of tables like the arp cache to get the mac to rewrite.  Now it's much more advanced:
http://www.cisco.com/en/US/tech/tk827/tk831/technologies_white_paper09186a00800a62d9.shtml

And all this done on specialized hardware that does this on processors specific made to do these operations, and memory that is addressable so it's fast for linked lists.  There is a lot of different work from all different types of industry that goes into making the internet work. In case you didn't know the phone backones are migrating to packet switching technology from SS7 signaling I believe, so this is the future..


I would like to know assembler, and C ( I took four classes in college in C and still have no idea what i'm doing).  I guess mainly because I just tried to get by :).  So if you learn that stuff, and can work with gdb the debugger, put stop points in the C program, analyze the stack and heap, you can work with buffer overflows, and have the understanding to analyze command and control bot networks.  I just think that type of stuff is interesting.


Here's something I wrote last week that I was very happy to finish.  It goes and grabs a list of networks that are on a "very very very bad" list, and updates the list of routers every hour with the changes add or remove:
So you just set a couple variables and cron it and you are good.  I guess if you wanted it to work on every  *nix type system you would setup a configure script.


Quote from: bash
#!/bin/bash
set -eu
#grabs the DROP list from spamhaus, and updates from router.  after first run updates only changes
mydir=/var/scripts/droplist
cloginpath=/var/lib/rancid/bin
routers="ip's of routers"
cd $mydir


#y will test if this is the first time the script has been run, if so we will launch the update script with only the current droplist and no comparision
y="0"

if [ ! -e DropFileNameList ]; then
touch DropFileNameList
y="1"
fi

# set the parameters to be passed to the update perl script, the last updated DROP list
if [ $y != 1 ]; then
   OlderDropFile=`tail --lines=1 DropFileNameList`
   plmod='-o'
else
   OlderDropFile=''
   plmod=''
fi

#grab the DROP list, store the most recent droplist in variable NewDropFile      
wget --output-document=$(date +%F) www.spamhaus.org/drop/drop.lasso
date +%F >> DropFileNameList
NewDropFile=`tail --lines=1 DropFileNameList`

#run the script if the drop list is smaller than 500 lines
sizeoflist=`wc -l DropFileNameList | cut -f 1 -d " "`
if [ $sizeoflist -lt 500 ]; then
   #call the update program push route configuration commands to the DroPush file, overwrite
   ./dropupdate.pl $plmod $OlderDropFile $NewDropFile > DropPush
   echo -e "config term\n$(cat DropPush)\nend\nwr mem\nexit\n" > DropPush
fi

#make sure ip route commands exist
if [ $(grep ip DropPush) ]; then
$cloginpath/clogin -x $mydir/DropPush $routers
fi

The perl script someone else wrote that parses the droplist, updated it to change the commands from unix route commands to cisco route commands, and added some sanitzation to input so the nets can't be big or your own..

it's basically taking cidr style mask notation /1-/32 (the number of bits in the network portion of the ip), and changing them to four bytes of decimanl numbers, so /32 gets changed to 255.255.255.255, nice and easy to do in perl, try that in C

Quote from: perl
#!/usr/bin/perl
# -*- perl -*-

use Getopt::Std;
use strict;
use vars qw{%nets $n $m $opt_o};

getopts('o:');

while(<>) {
    if(($n, $m) = m{(\d+\.\d+\.\d+\.\d+)/(\d+)}) {
        # local sanity check
        die "local network $n" if $n =~ /^127.|^your networks here|^0.0/;
        die "mask /$m to large" if $m < 7;
        $nets{$n} = $m;
    } else {
#       $x = 1;
    }
}

# do old thing here sometime
if($opt_o) {
    open(OLD, $opt_o) or die "Cannot open $opt_o $!";

    while(<OLD>) {
        if(($n, $m) = m{(\d+\.\d+\.\d+\.\d+)/(\d+)}) {
            my $mask = join '.',unpack "CCCC", pack "N", -1<<(32-$m);

            if(exists $nets{$n} and $nets{$n} == $m) {
#               print "# exists route add -net $n/$m\n";
                delete $nets{$n};
            } else {
                print "no ip route $n $mask Null0\n"; #route delete -net $n -netmask $mask\n";
                #print "route delete -net $n/$m\n";
            }
        } else {
            #print "#??? $_\n";
 #           $x = 1;
        }
    }
    close OLD;
}

while(($n, $m) = each %nets) {
    my $mask = join '.',unpack "CCCC", pack "N", -1<<(32-$m);

    #print "route add -net $n -netmask $m 127.1 -blackhole # m\n";
    #print "route add -net $n/$m 127.1 -blackhole\n";
    print "ip route $n $mask Null0\n";
}



« Last Edit: July 10, 2009, 02:58:20 PM by reaper »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
VaeVictus "reaper is a lying sack of shit and ragequit then had, probably slugs, come alias and beat me, wasnt even the same person playing OBVIOUSLY, accuracies basicly doubled, and strategy

 

El Box de Shoutamente

Last 10 Shouts:

 

Costigan_Q2

November 11, 2024, 06:41:06 AM
"Stay cozy folks.

Everything is gonna be fine."

There'll be no excuses for having TDS after January 20th, there'll be no excuses AT ALL!!!
 

|iR|Focalor

November 06, 2024, 03:28:50 AM
 

RailWolf

November 05, 2024, 03:13:44 PM
Nice :)

Tom Servo

November 04, 2024, 05:05:24 PM
The Joe Rogan Experience episode 223 that dropped a couple hours ago with Musk, they're talking about Quake lol.
 

Costigan_Q2

November 04, 2024, 03:37:55 PM
Stay cozy folks.

Everything is gonna be fine.
 

|iR|Focalor

October 31, 2024, 08:56:37 PM
 

Costigan_Q2

October 17, 2024, 06:31:53 PM
Not activated your account yet?

Activate it now! join in the fun!

Tom Servo

October 11, 2024, 03:35:36 PM
HAHAHAHAHAHA
 

|iR|Focalor

October 10, 2024, 12:19:41 PM
I don't worship the devil. Jesus is Lord, friend. He died for your sins. He will forgive you if you just ask.
 

rikwad

October 09, 2024, 07:57:21 PM
Sorry, I couldn't resist my inner asshole.

Show 50 latest
Welcome, Guest. Please login or register.
November 15, 2024, 05:28:34 AM

Login with username, password and session length