Fortinet white logo
Fortinet white logo

Script Reference Guide

Rewrite HTTP to HTTPS in referrer

Rewrite HTTP to HTTPS in referrer

You can rewrite HTTP request headers to replace all HTTP addresses with HTTPS addresses in the redirect referrer.

Rewrite the HTTP request header to replace HTTP addresses with HTTPS in the redirect referrer:
when HTTP_RESPONSE{
ref = HTTP:header_get_value("Referrer")
if ref then
newref = string.gsub(ref, "http", "https") --replace all http by https in the referrer header
HTTP:header_replace("Referer", newref);
end
}

Rewrite HTTP to HTTPS in referrer

Rewrite HTTP to HTTPS in referrer

You can rewrite HTTP request headers to replace all HTTP addresses with HTTPS addresses in the redirect referrer.

Rewrite the HTTP request header to replace HTTP addresses with HTTPS in the redirect referrer:
when HTTP_RESPONSE{
ref = HTTP:header_get_value("Referrer")
if ref then
newref = string.gsub(ref, "http", "https") --replace all http by https in the referrer header
HTTP:header_replace("Referer", newref);
end
}