cancel
Showing results for 
Search instead for 
Did you mean: 

redirect http to https

SOLVED
slicerpro
Occasional Contributor

redirect http to https

Hi all

I am running vTM 10.4 with several virtual servers configured. Our licence does not include TrafficScript but I need to be able to redirect any http requests to https first for one virtual server to test, and then eventually for all the servers. How can I do this?

2 ACCEPTED SOLUTIONS

Accepted Solutions
PaulWallace
Contributor

Re: redirect http to https

ok, great to hear that worked for you.

 

To save time on your other sites, you should be able to make copies of this rule, save as a different name, and then just edit in the correct domain name used for each. The rules are saved in the top-level catalog, and you can then enable/disable rules for each virtual server. You can keep rules in the catalog and enable/disable/edit to customize the behavior of each virtual server.

 

Or... TrafficScript! With TrafficScript, you could write a single rule which would work for any domain name. There are many, many more powerful things you can do with TrafficScript. You create rules which are easy to read and maintain, and even create libraries which encapsulate your own business rules. You can create simple rules with the RuleBuilder GUI interface, and then see how that rule is implemented in TrafficScript, making it easy to create and customize rules.

 

You can also use command line scripts, partial backup/restore or REST APIs to automate rule management. There is even an Eclipse IDE plug in which lets you create rules offline, and drag'n'drop between vTM instances. See http://community.brocade.com/t5/vADC-Forum/Stingray-Plugin-for-Eclipse/td-p/72351 

 

If you want to test with TrafficScript, then you can easily download our Developer Edition for free, go to http://brocade.com/vtm and click on the button there - or alternatively, install another copy of vTM without a license key. You can test all the features of vTM in Developer Mode, subject to a restricted bandwidth limit.

View solution in original post

slicerpro
Occasional Contributor

Re: redirect http to https

Follow up, please let me know if my intended configuration will work. We have a client that wants to use one VIP to host 5 domains. I have a text file i'm about to upload, please review and let me know if it will work. I've replaced real names with fictional ones.

 

if( string.contains( http.getheader( "Host" ), "domain1.example.com" ) ){

http.redirect( "https://domain1.example.com" );

}

else if( string.contains( http.getheader( "Host" ), "domain2.example.com" ) ){

http.redirect( "https://domain2.example.com" );

}

else if( string.contains( http.getheader( "Host" ), "domain3.example.com" ) ){

http.redirect( "https://domain3.example.com" );

}

else if( string.contains( http.getheader( "Host" ), "domain4.example.com" ) ){

http.redirect( "https://domain4.example.com" );

}

else if( string.contains( http.getheader( "Host" ), "domain5.example.com" ) ){

http.redirect( "https://domain5.example.com" );

}

 

 

 

 

View solution in original post

17 REPLIES 17
PaulWallace
Contributor

Re: redirect http to https

Although TrafficScript gives you much more flexibilty to create powerful rules, you may be able to use the simple RuleBuilder to create simple conditional logic. This article gives an example how you might be able to do this:

 

http://community.brocade.com/t5/vADC-Forum/Redirect-HTTPS-URL/td-p/72667

 

slicerpro
Occasional Contributor

Re: redirect http to https

Thanks Paul for your response. I'm looking to configure one rule that I can apply to all sites as opposed one that is specific to only one site. Any other ideas?

PaulWallace
Contributor

Re: redirect http to https

How many sites are you hosting? Do they all resolve to the same Traffic IP Address?

slicerpro
Occasional Contributor

Re: redirect http to https

We are hosting about 5 sites.. each with its own IP address. All said and done, I was able to implement a simple rule for one one site for testing. My rule basically says for requests and responses, if host header  contains "abc.com", then set response header to "https://abc.com . I tested it and it is working as desired. This having been my first such configuration as far as vTM is concerned, I will appreciate any suggestions to make it more nimble when I move to configure the other sites.

PaulWallace
Contributor

Re: redirect http to https

ok, great to hear that worked for you.

 

To save time on your other sites, you should be able to make copies of this rule, save as a different name, and then just edit in the correct domain name used for each. The rules are saved in the top-level catalog, and you can then enable/disable rules for each virtual server. You can keep rules in the catalog and enable/disable/edit to customize the behavior of each virtual server.

 

Or... TrafficScript! With TrafficScript, you could write a single rule which would work for any domain name. There are many, many more powerful things you can do with TrafficScript. You create rules which are easy to read and maintain, and even create libraries which encapsulate your own business rules. You can create simple rules with the RuleBuilder GUI interface, and then see how that rule is implemented in TrafficScript, making it easy to create and customize rules.

 

You can also use command line scripts, partial backup/restore or REST APIs to automate rule management. There is even an Eclipse IDE plug in which lets you create rules offline, and drag'n'drop between vTM instances. See http://community.brocade.com/t5/vADC-Forum/Stingray-Plugin-for-Eclipse/td-p/72351 

 

If you want to test with TrafficScript, then you can easily download our Developer Edition for free, go to http://brocade.com/vtm and click on the button there - or alternatively, install another copy of vTM without a license key. You can test all the features of vTM in Developer Mode, subject to a restricted bandwidth limit.

slicerpro
Occasional Contributor

Re: redirect http to https

Paul, I'm back to continue the conversation. My other client would like to redirect http to https. He has one VIP for all his 5 domains. For example: 
main domain: example.com

1st domain   : domain1.example.com

2nd domain  : domain2.example.com

3rd domain   : domain3.example.com

4th domain   : domain4.example.com

5th domain   : domain5.example.com

 

Here are the entire contents of the text file I'm about to upload to TrafficScipt. Please take a look and let me know if I'm missing something:

 

if( string.contains( http.getheader( "Host" ), "domain1.example.com" ) ){

http.redirect( "https://domain1.example.com" );

}

if( string.contains( http.getheader( "Host" ), "domain2.example.com" ) ){

http.redirect( "https://domain2.example.com" );

}

if( string.contains( http.getheader( "Host" ), "domain3.example.com" ) ){

http.redirect( "https://domain3.example.com" );

}

if( string.contains( http.getheader( "Host" ), "domain4.example.com" ) ){

http.redirect( "https://domain4.example.com" );

}

if( string.contains( http.getheader( "Host" ), "domain5.example.com" ) ){

http.redirect( "https://domain5.example.com" );

}

 

Let me know if you think it will work.

slicerpro
Occasional Contributor

Re: redirect http to https

Follow up, please let me know if my intended configuration will work. We have a client that wants to use one VIP to host 5 domains. I have a text file i'm about to upload, please review and let me know if it will work. I've replaced real names with fictional ones.

 

if( string.contains( http.getheader( "Host" ), "domain1.example.com" ) ){

http.redirect( "https://domain1.example.com" );

}

else if( string.contains( http.getheader( "Host" ), "domain2.example.com" ) ){

http.redirect( "https://domain2.example.com" );

}

else if( string.contains( http.getheader( "Host" ), "domain3.example.com" ) ){

http.redirect( "https://domain3.example.com" );

}

else if( string.contains( http.getheader( "Host" ), "domain4.example.com" ) ){

http.redirect( "https://domain4.example.com" );

}

else if( string.contains( http.getheader( "Host" ), "domain5.example.com" ) ){

http.redirect( "https://domain5.example.com" );

}

 

 

 

 

slicerpro
Occasional Contributor

Re: redirect http to https

better yet is there a way to do this dynamically so that anytime they add domainX.example.com, it gets redirected to https://domainX.example.com ?

slicerpro
Occasional Contributor

Re: redirect http to https

That worked, but the Client still wondered if there is a way to put in a dynamic rule allowing him to spin up domains on demand and not having to reconfigure redirect rules on the Traffic manager.