> is there a way to do this dynamically so that anytime they add
> domainX.example.com, it gets redirected to https://domainX.example.com ?
RuleBuilder is designed to create very simple rules - but TrafficScript makes this VERY easy with this one-line rule:
http.changeSite( "https://" . http.getHostHeader() );
1. Look up the host header of the request
2. Add the prefix "https://"
3. Force redirect to the new URL, retaining the URL path of the original request
4. You could add other conditions, such as for certain content types, countries or force alternate redirects as needed
5. See the TrafficScript user guide at http://brocade.com/vadc-docs for details of http.changeSite() vs http.redirect()
This article shows a couple of other examples, including how to redirect to a country-specific website:
http://community.brocade.com/t5/vADC-Docs/HowTo-Redirect-HTTP-clients/ta-p/73709
Hope that helps!
Re: multiple if/then sequence:
I guess that your sequence of if/then statements would work, but note that if a request is intended for "domain5" then you will execute each test several times over. Using a switch() or an array lookup might make it easier to maintain, but I don't think you can create that with RuleBuilder.
Re: Dynamic rules:
You may also be able to use the REST API to set rules dynamically - but the earlier TrafficScript example makes the redirect even easier.
I'm planning to put this in:
$request = http.getRequest();
if( string.contains( http.getheader( "Host" ), "example.com" ) ){
http.changeSite( "https://" . http.getHostHeader() );
}
I guess my question would be: what is the full syntax for the example(http.changeSite( "https://" . http.getHostHeader() );) you've given above?
This is a different client and they do have TrafficScript licensed.
using the ' http.changeSite' command send back to source a 301 HTTP redirect wit the new URL.
but i want to receive a HTTP request , change it to a HTTPS request i.e http://site1.com -> https://site2.com,
and then send it on to a pool/back end node, is this possible
i have tried to use
# Rewrite host header if necessary
http.setHeader( "Host", "https://site2.com" );
pool.use( "pool_site2" );
But this fails
I keep on getting error 500, internal server error
is there another way to do this