Showing results for 
Search instead for 
Did you mean: 

URL masking


URL masking

HI I was wondering is it possible to use traffic script to mask a url for example:


Our website is served from :


However I wish this to be presented to the client in their browser as and translate any real pages via links on the site to look like they are being served by the masked domain without effecting any functionality so the client is oblivous to the fact that they are actually using the real site which is being served from


Obviously we need to be incontrol of both domains  inorder for this to work but I am stuck as where to start to use traffic script to do this. This would be really great if someone could help me.

Frequent Contributor

Re: URL masking

There are two ways you could approach this problem...


The first (and easiest) is to redirect your users (issue a 302 redirect that causes their browsers to load the content from when they access

I think that the 'http.changeSite()' trafficscript function will do what you need:

# Send users to our new site

if( http.getHostHeader() == "" ) {

  http.changeSite( "" );


If users request content from, this code will redirect them to the same content on using an http 302 redirect.  Note that their browser location bar will indicate that they are retrieving content from, which perhaps is not what you wanted?


The alternative approach is to rewrite their HTTP requests and forward them to the original website.  In this situation, it's sufficient to modify the host header in the request and forward it on:

if( http.getHostHeader() == "" ) {

  http.setHeader( "Host", "" );

  pool.use( " servers" );


Then your users can browse, and the content is retrieved from

There are a few potential pitfalls to this approach.  The content may contain links (hrefs, image srcs etc) to which you would need to rewrite; the web server may issue HTTP Location redirects to, or issue cookies that are tied to the domain.  It's not trivial to work around these problems - the Getting Started - Load-balancing to a website using Stingray Traffic Manager article describes the steps you will need to take.