In below if statement how to check for if the request is not a redirect?
if { [HTTP::header is_redirect]} {}
In below if statement how to check for if the request is not a redirect?
if { [HTTP::header is_redirect]} {}
if { [HTTP::is_redirect] > 0 } {}
Also:
if { not ( [HTTP::header exists Location] ) } {
Kevin and Michael, Thanks for your response.
But it sounds like there is no better way if the request if a direct request or as a result of Redirect. I have tried below script and the result seems to be same(see below):
when HTTP_RESPONSE {
if { [HTTP::is_redirect] } {set a 1} if { [HTTP::header is_redirect] } {set b 1} if { [HTTP::header exists Location] } {set c 1}
if { not ([HTTP::is_redirect]) } {set a 0} if { not ([HTTP::header is_redirect]) } {set b 0} if { not ([HTTP::header exists Location]) } {set c 0}
set x [HTTP::is_redirect] set y [HTTP::header is_redirect] set z [HTTP::header exists Location]
set result [format “x=%s y=%s z=%s a=%s b=%s c=%s” $x $y $z $a $b $c]
HTTP::respond 200 content $result
}
RESULT: in any case the result is same as below! x=0 y=0 z=0 a=0 b=0 c=0
So I am just not sure if any of these conditions are working.
The redirection is trigger from another rule as below where myDNS is substituted: HTTP::respond 302 noserver Location “https://$uri”
So why not just do what you are trying to accomplish on the inital response before checking for a redirect? What is the end goal?
when HTTP_RESPONSE {
set a 0
set b 0
set c 0
if { [HTTP::is_redirect] } {
set a 1
set b 1
set c 1
}
}