Monday 27 July 2020

How-to: Add X-Forwarded-Proto in FortiADC

The FortiADC allows you to add X-Forwarded-Proto headers to server requests using scripting.

To do this, add a new script under Server Load Balance > Scripting and create a new script with the following:

when HTTP_REQUEST{
 host = HTTP:header_get_value("Host")
 if host:lower():find("adc.fortilab.local") then
  log("found adc.fortilab.local in Host %s \n", host)
  HTTP:header_insert("X-Forwarded-Proto", "https")
 end
}

Enable the script in your virtual server by going to Server Load Balance > Virtual Server. Edit your virtual server and select the General tab and select your script.



Now when you access the web server the X-Forwarded-Proto header will be sent to the server.

1 comment:

Unknown said...

Hello Allan,

I like your blog, helps so much. I have been working on an query which is youtube report in FortiAnalzyer v6.4.3-build2201 201021. As you wrote about it 6 years ago and it wont work in the forti 6.4.3. Just wonder could you help me about the query for v6.4.3 ?

my email emre.kaptan@gmail.com

Cheers
Emre