cancel
Showing results for 
Search instead for 
Did you mean: 

Redirect AND mask URL?

SOLVED
Highlighted
New Contributor

Redirect AND mask URL?

I have a website that I want users to access at something.domain.com which actually resides at server.domain.com/something. I can get the redirect from something.domain.com to server.domain.com/something working without any problems, but I can't seem to get the address bar to reflect the something.domain.com URL that I need.

The rule I am using now (that doesn't work) is as follows. It is What am I missing?


$host = http.getheader( "Host" );



if($host == "something.domain.com" ){


   http.redirect( "http://server.domain.com/something" );


   http.setHeader( "Host", "something.domain.com" );


}


Thanks for the assist!

5 REPLIES
Contributor

Re: Redirect AND mask URL?

Hi Aaron,

a http.redirect immediately sends out the response and further traffic script will not be executed. Thats why your rule just ends at the line "http.redirect".

But what do you want to achieve? a redirect tells the browser "got to the new url", so your old url will not be displayed/used anymore.

If you want to keep the old URL in the browser and just show content from the new, you can use the new one as a "node" (but linking withing the website could be tricky...)

-Jochen

New Contributor

Re: Redirect AND mask URL?

We are trying to set up a default website for one of our wireless SSIDs which all traffic will be forced to when people connect to it. I am trying to deliver the contents of a flat website (so linking in the site is not an issue) that is on an existing web server along with several other sites (all of the sub-sites are in folders off of the main site).  In order for it to work, everything needs to appear as coming from root level of something.domain.com to the end user, so both the redirect and the URL masking is critical. Any other thoughts on how to make this happen?

Thanks!

Occasional Contributor

Re: Redirect AND mask URL?

Hi Aaron:

Try this:


if( http.getHostHeader() == "something.domain.com" )


{


   http.changeSite( "http://server.domain.com/something" );


}



BR

Felix

Contributor

Re: Redirect AND mask URL?

create a vserver for something.domain.com

then use a rule to

1. set the http header to the correct value

(i guess http.setHeader( "Host", "something.domain.com" );

2. set the url

http.setPath( "/something" );

3. create a pool (named "poolwithoneserver") with one server:

server.domain.com:80


4. last statement of the rule:

pool.use("poolwithoneserver");

so, your existing server is just a node for a different vserver, and you have to modify the path and the hostheader for every request.


New Contributor

Re: Redirect AND mask URL?

So I finally got a chance to work on this some more, but I couldn't get your solution to work. I could get the URL to point to the correct server, but for some reason the web server was bringing up one of its vhosts instead of the site I wanted. To solve the problem, I just added the something.domain.com site as anoher vhost on that server and I was able to solve the problem without using the Traffic Manager at all. I guess I just had to think outside of the confines of the load balancer. Thanks for the help!