Fortinet white logo
Fortinet white logo

Script Reference Guide

Rewrite HTTPS to HTTP in location

Rewrite HTTPS to HTTP in location

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

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

Rewrite HTTPS to HTTP in location

Rewrite HTTPS to HTTP in location

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

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