Showing results for 
Search instead for 
Did you mean: 

'Superimpose' a FQDN infront of a fixed FQDN with Stingray?

New Contributor

'Superimpose' a FQDN infront of a fixed FQDN with Stingray?

I'm sure this is possible with Stingray, just not 100% if it is, or how complicated it would be...

If you have an e-commerce site, say and for some daft reason, the e-commerce software fixes you to this one single domain (not a license restriction, but a functionality one) - and we wanted to be able to 'superimpose' so that this FQDN 'worked' in front of the website - by running response and request re-writing on the Stingray - would this work - would this allow us to use both .com and .de domains on this single site?

So requests for would land on the Stingray, which would re-write the requests through to the web server actually as even though the user sees in their browser. The response from the webserver would of course still come back from so we would need to also e-write this back as, however I suspect this element would be far tricker, as we would actually need to re-write links in the <BODY> also.

As long as the Stingray is doing SSL decrypt, would this work in theory? Any examples / tips to help us experiment?

I know the language etc would all be the same, it's just a .de domain needs to present in the browser!

The other route is to create a site for each domain, etc...



Frequent Contributor

Re: 'Superimpose' a FQDN infront of a fixed FQDN with Stingray?

Should be easy to achieve... the easiest solution would be to inspect the body data and strip out any '", so you end up with relative links (/products) rather than full ones (

Then, your customers web browsers will just assume that the domain has not changed, so they will continue to use or as appropriate.

Also, check out the location and cookie rewrite settings in the connection management part of the Stingray virtual server.  If your website tries to redirect your clients to a particular domain, or pin a cookie to that domain, we can fix that too



New Contributor

Re: 'Superimpose' a FQDN infront of a fixed FQDN with Stingray?

OK so I *sort* of got this working, although as you will see - it's kind of messy.

I checked the cookies and it does not seem like there is anything going on there.

First of all I stuck a simple http.setheader rule in to detect the 'de' domain and replace it with the only domain that is supposed to work - the one - this is a request rule:

if( string.contains( http.getheader( "host" ), "" ) ){

        http.setheader( "host", "" );


So this just tinkers with the host header going from the Stingray to the back end server. I think this is OK.

Next, is where I kind of go off the rails. I need to tinker with the response that comes back from the webserver to the client, and basically strip the domain out whatever it is....

# settings

$domainStrip = "";

$domainUK = "";

# end settings

# rewrite all links to strip domain

$response = http.getResponseBody();

if( string.contains( $response, $domainUK ) ) {

$response = string.regexsub( $response , $domainUK, $domainStrip, "g" );


http.setResponseBody( $response );

This very nearly works, however for some reason, some of the sites js and css files don't come down from the new FQDN, but instead http://path/to/css rather than If I substitute the stripped domain "" setting for the actual DE domain - then it all works wonderfully, but of course doing this, everything gets written as DE which is not what we want to achieve!!!

Looking at responses coming back in firebug I can see the all the offending css/js are missing a forward slash - I'm sure this has something to do with it. Working css/js objects show as /path/to/css - when the non-working ones show as path/to/css.

Why some css/js are behaving differently - not really sure.

Dodgy coding!?!?

(most likely mine!)


Frequent Contributor

Re: Re: 'Superimpose' a FQDN infront of a fixed FQDN with Stingray?

Hi Jeff,

Try stripping the entire from the start of the URL.  This has the advantage that you're less likely to modify content by mistake (for example, if the text of your document says "visit", you don't want to remove the domain from that text).

The following ought to do the trick:

$body = http.getResponseBody();

$newbody = string.replaceAll( $body, "", "" );

if( $newbody != $body ) http.setResponseBody( $newbody );

You want each URL to begin with a '/'; if a web client encounters a URL that looks like "/path/to/resource.html", it will deduce that the protocol, port and domain/host should be the same as the referring document.

One recommendation - take a look at the source of the document as well as using firebug.  The source is the definitive record of what you have changed.

Hope that this helps