vADC Forum

Reply
Brocadian
Posts: 105
Registered: ‎04-22-2015

Re: redirect http to https

> 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!

 

 

Brocadian
Posts: 105
Registered: ‎04-22-2015

Re: redirect http to https

[ Edited ]

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.

 

Contributor
Posts: 22
Registered: ‎12-29-2015

Re: redirect http to https

I'm planning to put this in:

 

$request = http.getRequest();
if( string.contains( http.getheader( "Host" ), "example.com" ) ){
http.changeSite( "https://" . http.getHostHeader() );
}

Contributor
Posts: 22
Registered: ‎12-29-2015

Re: redirect http to https

I guess my question would be: what is the full syntax for the example(http.changeSite( "https://" . http.getHostHeader() ); you've given above?

Brocadian
Posts: 105
Registered: ‎04-22-2015

Re: redirect http to https

The detailed syntax for all TrafficScript functions can be found in the user guide. The most recent set of user guides can be found at http://brocade.com/vadc-docs

The current (17.1) TrafficScript guide is here:
http://www.brocade.com/en/backend-content/pdf-page.html?/content/dam/secure-external/product-guides/virtual-traffic-manager/17-1/brocade-vtm-17.1-tscript.pdf
Brocadian
Posts: 105
Registered: ‎04-22-2015

Re: redirect http to https

HOWEVER: note that you need to have TrafficScript enabled to create custom rules like this. I recall that you said earlier that your licence does not include TrafficScript?
Contributor
Posts: 22
Registered: ‎12-29-2015

Re: redirect http to https

This is a different client and they do have TrafficScript licensed.

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.

Download FREE NVMe eBook