This article describes how to configure the NetScaler appliance to redirect network traffic from a HTTP to HTTPS virtual IP address. It also describes how to configure the HTTP/80 load balancing virtual IP address to result in a 301 Permanent Redirect.
To set up a HTTP to HTTPS redirect, create an HTTP/80 load balancing virtual IP address, disable it, and configure the Redirect URL to the HTTPS web page. However, this results in a 302 Temporary Redirect.
To configure the NetScaler appliance to redirect network traffic from a HTTP to HTTPS virtual IP address, complete the following procedure:
Ensure that the status of the HTTP/80 load balancing virtual server is set as UP, and is bound to the correct service.
Create a responder action with Respond With type and with the following Target:
"HTTP/1.1 301 Moved Permanently\r\n" + "Location: https://domain.com" + "\r\n\r\n"
Note: If you want to retain the path and query, configure with the following Target:
"HTTP/1.1 301 Moved Permanently\r\n" + "Location: https://domain.com" + http.req.url.path_and_query.http_url_safe + "\r\n\r\n"
Alternately, create a responder Action with Redirect type and the following Target :
Create a responder policy with an expression HTTP.REQ.URL.CONTAINS("/") and bind the responder action to it.
Bind the responder policy to the specific HTTP/80 load balancing virtual server.
Note: When you run a header trace, you should see the HTTP/1.1 301 Moved Permanently message, as shown in the following screen shot.