Rewrite Policy - Redirect HTTP Requests to HTTPS

Added by Catherine Hampton , last edited by Catherine Hampton on Mar 05, 2008  (view change)
Tags: 

This article describes how to rewrite web server responses to find all URLs that begin with the string "http" and replace that string with "https".

Summary

The procedure below describes how to create a Rewrite expression that checks web server responses for body URLs that begin with the string http, and replaces that string with the string https. For example, if your web site responses include the URL http://mail.example.com/exchange, you can use this procedure to rewrite this URL as https://mail.example.com/exchange.

First, you add the rewrite action, named replace_https, as shown below:
      > add rewrite action replace_https replace_all 'HTTP.RES.BODY(100)' '"https"' -pattern http

Next, you add the rewrite policy, named replace_http_pol, as shown below:
      > add rewrite policy replace_http_pol TRUE replace_https NOREWRITE

Finally, you globally bind the rewrite policy to put it into effect:
      > bind rewrite global replace_http_pol 1 -type RES_DEFAULT

More Information