Skip to content

Instantly share code, notes, and snippets.

@dwallraff
Last active April 26, 2018 09:40
Show Gist options
  • Save dwallraff/5906c05b766cd5c17c07e444798b5630 to your computer and use it in GitHub Desktop.
Save dwallraff/5906c05b766cd5c17c07e444798b5630 to your computer and use it in GitHub Desktop.
F5 config - X-Forward-Proto (XFP)
# Recommended solution would be:
# - Use Insert header, in the custom HTTP profile that you applied to the virtual servers.
# For HTTPS Virtuals, insert: X-Forwarded-Proto, with a value of https
# For HTTP Virtuals, insert: X-Forwarded-Proto, with a value of http
# Of course you could also use apply an iRule to the Virtual Server, something like this should work:
when HTTP_REQUEST {
if { [SSL::mode] == 1 } {
if {!( [HTTP::header "X-Forwarded-Proto"] eq "https") }{
HTTP::header insert X-Forwarded-Proto "https"
}
if { !( [HTTP::header exists "X-Forwarded-Port"]) }{
HTTP::header insert X-Forwarded-Port [TCP::local_port]
}
}
}
@duypm
Copy link

duypm commented Feb 7, 2018

Just so you know, this is missing a close-brace for the first if statement at line 10

@dwallraff
Copy link
Author

Good catch @duypm, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment