How to force a browser to use HTTPS instead of HTTP when accessing a specific URL
search cancel

How to force a browser to use HTTPS instead of HTTP when accessing a specific URL

book

Article ID: 166401

calendar_today

Updated On:

Products

ProxySG Software - SGOS

Issue/Introduction

To force a browser to use HTTPS instead of HTTP, a policy needs to be in place so that the proxy can send an HTTP-302 message (redirect) to the browser.

Resolution

The policy will maintain any path that was first provided with the original request. You need to install the CPL code in the local policy file on the ProxySG

For example, if you need to force clients to use https when accessing  www.facebook.com, then the required policy would be as follows:

;;;;;;;;start of the policy

<PROXY>

ALLOW url.scheme=http url.host=www.facebook.com action.Redirect_to_HTTPS_example(yes)

define action Redirect_to_HTTPS_example
  redirect( 302, "
http://www.facebook.com(.*)", "https://www.facebook.com$(1)" )
end action Redirect_to_HTTPS_example

;;;;;;;end of the policy